Indicate modified in version string

issue 40365
This commit is contained in:
Arlo Breault 2024-06-26 11:31:15 -04:00 committed by Shelikhoo
parent e2ba4d3539
commit ffdda1358a
No known key found for this signature in database
GPG key ID: 4C9764E9FE80A3DC

View file

@ -8,12 +8,22 @@ import (
var version = func() string {
ver := "2.9.2"
if info, ok := debug.ReadBuildInfo(); ok {
var revision string
var modified string
for _, setting := range info.Settings {
if setting.Key == "vcs.revision" {
return fmt.Sprintf("%v (%v)", ver, setting.Value[:8])
switch setting.Key {
case "vcs.revision":
revision = setting.Value[:8]
case "vcs.modified":
if setting.Value == "true" {
modified = "*"
}
}
}
if revision != "" {
return fmt.Sprintf("%v (%v%v)", ver, revision, modified)
}
}
return ver
}()