Skip to content

Commit

Permalink
feat(config): drop dirty modifier from version string
Browse files Browse the repository at this point in the history
  • Loading branch information
tronghn committed Nov 29, 2023
1 parent acede83 commit 6d32363
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,27 +416,19 @@ func version() string {

var rev string
var last time.Time
var dirty bool

for _, kv := range info.Settings {
switch kv.Key {
case "vcs.revision":
rev = kv.Value
case "vcs.time":
last, _ = time.Parse(time.RFC3339, kv.Value)
case "vcs.modified":
dirty = kv.Value == "true"
}
}

if len(rev) > 7 {
rev = rev[:7]
}

v := fmt.Sprintf("%s-%s", last.Format("2006-01-02-150405"), rev)
if dirty {
v += " (dirty)"
}

return v
return fmt.Sprintf("%s-%s", last.Format("2006-01-02-150405"), rev)
}

0 comments on commit 6d32363

Please sign in to comment.