at master 1.3 kB view raw
1diff --git a/moxvar/version.go b/moxvar/version.go 2index 0b69cd9..9a5a5da 100644 3--- a/moxvar/version.go 4+++ b/moxvar/version.go 5@@ -1,51 +1,6 @@ 6 // Package moxvar provides the version number of a mox build. 7 package moxvar 8 9-import ( 10- "runtime" 11- "runtime/debug" 12-) 13- 14-// Version is set at runtime based on the Go module used to build. 15+// Version and VersionBare are set via a build flag. 16 var Version string 17- 18-// VersionBare does not add a "+modifications", goversion or other suffix to the version. 19-var VersionBare string 20- 21-func init() { 22- Version = "(devel)" 23- VersionBare = "(devel)" 24- 25- defer func() { 26- Version += "-" + runtime.Version() 27- }() 28- 29- buildInfo, ok := debug.ReadBuildInfo() 30- if !ok { 31- return 32- } 33- Version = buildInfo.Main.Version 34- VersionBare = buildInfo.Main.Version 35- if Version == "(devel)" { 36- var vcsRev, vcsMod string 37- for _, setting := range buildInfo.Settings { 38- if setting.Key == "vcs.revision" { 39- vcsRev = setting.Value 40- } else if setting.Key == "vcs.modified" { 41- vcsMod = setting.Value 42- } 43- } 44- if vcsRev == "" { 45- return 46- } 47- Version = vcsRev 48- VersionBare = vcsRev 49- switch vcsMod { 50- case "false": 51- case "true": 52- Version += "+modifications" 53- default: 54- Version += "+unknown" 55- } 56- } 57-} 58+var VersionBare string 59\ No newline at end of file