-
Notifications
You must be signed in to change notification settings - Fork 4
/
version.go
26 lines (22 loc) · 878 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
package version
const UnknownVersion = "unknown"
const ProtocolVersion = "v2.0.0"
// provided at compile time
var (
GitCommit string // long commit hash of source tree, e.g. "0b5ed7a"
GitBranch string // current branch name the code is built off, e.g. "master"
GitTag string // current tag name the code is built off, e.g. "v1.5.0"
GitSummary string // output of "git describe --tags --dirty --always", e.g. "4cb95ca-dirty"
GitState string // whether there are uncommitted changes, e.g. "clean" or "dirty"
BuildDate string // RFC3339 formatted UTC date, e.g. "2016-08-04T18:07:54Z"
Version string // contents of ./VERSION file, if exists
GoVersion string // the version of go, e.g. "go version go1.10.3 darwin/amd64"
)
func AppVersion() string {
if GitTag != "" {
return GitTag
} else if Version != "" {
return Version
}
return UnknownVersion
}