summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/mo/mox/version.patch
blob: 66dc48c0e8646e61a1fd1b5539a6bfb21d79c72e (plain)
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
52
53
54
55
56
57
58
59
diff --git a/moxvar/version.go b/moxvar/version.go
index 0b69cd9..9a5a5da 100644
--- a/moxvar/version.go
+++ b/moxvar/version.go
@@ -1,51 +1,6 @@
 // Package moxvar provides the version number of a mox build.
 package moxvar

-import (
-	"runtime"
-	"runtime/debug"
-)
-
-// Version is set at runtime based on the Go module used to build.
+// Version and VersionBare are set via a build flag.
 var Version string
-
-// VersionBare does not add a "+modifications", goversion or other suffix to the version.
-var VersionBare string
-
-func init() {
-	Version = "(devel)"
-	VersionBare = "(devel)"
-
-	defer func() {
-		Version += "-" + runtime.Version()
-	}()
-
-	buildInfo, ok := debug.ReadBuildInfo()
-	if !ok {
-		return
-	}
-	Version = buildInfo.Main.Version
-	VersionBare = buildInfo.Main.Version
-	if Version == "(devel)" {
-		var vcsRev, vcsMod string
-		for _, setting := range buildInfo.Settings {
-			if setting.Key == "vcs.revision" {
-				vcsRev = setting.Value
-			} else if setting.Key == "vcs.modified" {
-				vcsMod = setting.Value
-			}
-		}
-		if vcsRev == "" {
-			return
-		}
-		Version = vcsRev
-		VersionBare = vcsRev
-		switch vcsMod {
-		case "false":
-		case "true":
-			Version += "+modifications"
-		default:
-			Version += "+unknown"
-		}
-	}
-}
+var VersionBare string
\ No newline at end of file