Skip to content

Commit

Permalink
cmd/skipper: do not show empty commit (#2955)
Browse files Browse the repository at this point in the history
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 <alexander.yastrebov@zalando.de>
  • Loading branch information
AlexanderYastrebov committed Feb 23, 2024
1 parent accfde5 commit 6c3386d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmd/skipper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func init() {
for _, setting := range info.Settings {
if setting.Key == "vcs.revision" {
commit = setting.Value[:min(8, len(setting.Value))]
break
}
}
}
Expand All @@ -51,11 +52,11 @@ func main() {
}

if cfg.PrintVersion {
fmt.Printf(
"Skipper version %s (commit: %s, runtime: %s)\n",
version, commit, runtime.Version(),
)

fmt.Printf("Skipper version %s (", version)
if commit != "" {
fmt.Printf("commit: %s, ", commit)
}
fmt.Printf("runtime: %s)\n", runtime.Version())
return
}

Expand Down

0 comments on commit 6c3386d

Please sign in to comment.