Skip to content

Commit 6c3386d

Browse files
cmd/skipper: do not show empty commit (#2955)
Binary installed via `go install github.com/zalando/skipper/cmd/skipper@latest` does not contain `vcs.revision`, see golang/go#65904 Followup on #2954 Signed-off-by: Alexander Yastrebov <[email protected]>
1 parent accfde5 commit 6c3386d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

cmd/skipper/main.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ func init() {
3838
for _, setting := range info.Settings {
3939
if setting.Key == "vcs.revision" {
4040
commit = setting.Value[:min(8, len(setting.Value))]
41+
break
4142
}
4243
}
4344
}
@@ -51,11 +52,11 @@ func main() {
5152
}
5253

5354
if cfg.PrintVersion {
54-
fmt.Printf(
55-
"Skipper version %s (commit: %s, runtime: %s)\n",
56-
version, commit, runtime.Version(),
57-
)
58-
55+
fmt.Printf("Skipper version %s (", version)
56+
if commit != "" {
57+
fmt.Printf("commit: %s, ", commit)
58+
}
59+
fmt.Printf("runtime: %s)\n", runtime.Version())
5960
return
6061
}
6162

0 commit comments

Comments
 (0)