/
version.go
41 lines (37 loc) · 921 Bytes
/
version.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
package pkg
import "runtime"
// Build-time arguments are used to populate these variables to generate
// build-specific version information.
var (
Version string
Commit string
Tag string
GoVersion string
BuildDate string
)
// versionInfo contains runtime and build time information about the application.
type versionInfo struct {
Version string
Commit string
Tag string
GoVersion string
BuildDate string
Compiler string
OS string
Arch string
}
// newVersionInfo creates a struct which holds all of the runtime and
// build-time supplied variables describing the version and build state
// for the application.
func newVersionInfo() versionInfo {
return versionInfo{
Version: Version,
Commit: Commit,
Tag: Tag,
GoVersion: GoVersion,
BuildDate: BuildDate,
Compiler: runtime.Compiler,
OS: runtime.GOOS,
Arch: runtime.GOARCH,
}
}