-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathmetadata.go
43 lines (38 loc) · 1.28 KB
/
metadata.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// SPDX-License-Identifier: Apache-2.0
package version
import "fmt"
const metaFormat = `{
Architecture: %s,
BuildDate: %s,
Compiler: %s,
GitCommit: %s,
GoVersion: %s,
OperatingSystem: %s,
}`
// Metadata represents extra information surrounding the application version.
type Metadata struct {
// Architecture represents the architecture information for the application.
Architecture string `json:"architecture,omitempty"`
// BuildDate represents the build date information for the application.
BuildDate string `json:"build_date,omitempty"`
// Compiler represents the compiler information for the application.
Compiler string `json:"compiler,omitempty"`
// GitCommit represents the git commit information for the application.
GitCommit string `json:"git_commit,omitempty"`
// GoVersion represents the golang version information for the application.
GoVersion string `json:"go_version,omitempty"`
// OperatingSystem represents the operating system information for the application.
OperatingSystem string `json:"operating_system,omitempty"`
}
// String implements the Stringer interface for the Metadata type.
func (m *Metadata) String() string {
return fmt.Sprintf(
metaFormat,
m.Architecture,
m.BuildDate,
m.Compiler,
m.GitCommit,
m.GoVersion,
m.OperatingSystem,
)
}