forked from infomodels/infomodels
-
Notifications
You must be signed in to change notification settings - Fork 0
/
version.go
51 lines (43 loc) · 1.22 KB
/
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
42
43
44
45
46
47
48
49
50
51
package main
import "github.com/blang/semver"
// SemVer components.
const (
progMajor = 0
progMinor = 2
progPatch = 1
progReleaseLevel = "final"
)
var (
// Populated at build time. See the Makefile for details.
// Note, in environments where the git information is not
// available, progBuild will not be populated. In
// environments where the BUILD_NUM environment variable
// is not available, progReleaseNum will not be populated.
progBuild string
progReleaseNum string
// Main semantic version for the CLI tool. If the release
// level is not final, it will be added along with the
// sha and build number at build time.
progVersion = semver.Version{
Major: progMajor,
Minor: progMinor,
Patch: progPatch,
}
)
func init() {
if progReleaseLevel != "final" {
// Add the release number.
progVersion.Pre = []semver.PRVersion{{
VersionStr: progReleaseLevel,
}}
// Add the build git sha if available.
if progBuild != "" {
progVersion.Build = []string{progBuild}
}
// Add the build number if available.
if progReleaseNum != "" {
releaseNumPRVersion, _ := semver.NewPRVersion(progReleaseNum)
progVersion.Pre = append(progVersion.Pre, releaseNumPRVersion)
}
}
}