diff --git a/version/version.go b/version/version.go index 5def6e5bb..82f694cf6 100644 --- a/version/version.go +++ b/version/version.go @@ -41,14 +41,11 @@ func init() { return } var dirty string // "-dirty" suffix if dirty - var commitHashAbbrev, commitDate string + var commitDate string for _, s := range bi.Settings { switch s.Key { case "vcs.revision": GitCommit = s.Value - if len(s.Value) >= 9 { - commitHashAbbrev = s.Value[:9] - } case "vcs.time": if len(s.Value) >= len("yyyy-mm-dd") { commitDate = s.Value[:len("yyyy-mm-dd")] @@ -61,6 +58,10 @@ func init() { } } } + commitHashAbbrev := GitCommit + if len(commitHashAbbrev) >= 9 { + commitHashAbbrev = commitHashAbbrev[:9] + } // Backup path, using Go 1.18's built-in git stamping. Short = strings.TrimSpace(tailscaleroot.Version) + "-dev" + commitDate