diff options
author | Jakob Unterwurzacher | 2022-12-29 15:21:17 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2022-12-29 15:21:17 +0100 |
commit | b2a5cec4dddd0bc4ece65ece2dd32908c5c2c994 (patch) | |
tree | 23469ddae34a86c88dd7ff7377b99a3999e02689 /version.go | |
parent | 856ccaac10579abda5620dfc86ad6031b1076a43 (diff) |
main: BuildInfo: fix build with Go 1.17 and older
On Go 1.17 and older we get this:
Error: ./version.go:67:24: info.Settings undefined (type *debug.BuildInfo has no field or method Settings)
Fix the build error by shedding some nice-to-have features.
Diffstat (limited to 'version.go')
-rw-r--r-- | version.go | 27 |
1 files changed, 1 insertions, 26 deletions
@@ -4,7 +4,6 @@ import ( "fmt" "runtime" "runtime/debug" - "strconv" "strings" "github.com/rfjakob/gocryptfs/v2/internal/stupidgcm" @@ -61,28 +60,9 @@ func versionFromBuildInfo() { tlog.Debug.Println("versionFromBuildInfo: ReadBuildInfo() failed") return } - // Parse BuildSettings - var vcsRevision, vcsTime string - var vcsModified bool - for _, s := range info.Settings { - switch s.Key { - case "vcs.revision": - vcsRevision = s.Value - case "vcs.time": - vcsTime = s.Value - case "vcs.modified": - vcsModified, _ = strconv.ParseBool(s.Value) - } - } // Fill our version strings - if GitVersion == gitVersionNotSet { + if GitVersion == gitVersionNotSet && info.Main.Version != "(devel)" { GitVersion = info.Main.Version - if GitVersion == "(devel)" && vcsRevision != "" { - GitVersion = fmt.Sprintf("vcs.revision=%s", vcsRevision) - } - if vcsModified { - GitVersion += "-dirty" - } } if GitVersionFuse == gitVersionFuseNotSet { for _, m := range info.Deps { @@ -95,9 +75,4 @@ func versionFromBuildInfo() { } } } - if BuildDate == buildDateNotSet { - if vcsTime != "" { - BuildDate = fmt.Sprintf("vcs.time=%s", vcsTime) - } - } } |