Skip to content

Commit

Permalink
Fix --version output (#1352)
Browse files Browse the repository at this point in the history
* Fix `--version` output

Signed-off-by: Tim Vaillancourt <[email protected]>

* Always fallback version/commit if undef

Signed-off-by: Tim Vaillancourt <[email protected]>

---------

Signed-off-by: Tim Vaillancourt <[email protected]>
  • Loading branch information
timvaillancourt authored Dec 11, 2023
1 parent 5ebb953 commit 679d39e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions go/cmd/gh-ost/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,15 @@ func main() {
flag.PrintDefaults()
return
}

if AppVersion == "" {
AppVersion = "unversioned"
}
if GitCommit == "" {
GitCommit = "unknown"
}
if *version {
appVersion := AppVersion
if appVersion == "" {
appVersion = "unversioned"
}
fmt.Printf("%s (git commit: %s)", appVersion, GitCommit)
fmt.Printf("%s (git commit: %s)\n", AppVersion, GitCommit)
return
}

Expand Down

0 comments on commit 679d39e

Please sign in to comment.