Skip to content

Commit 679d39e

Browse files
Fix --version output (#1352)
* 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]>
1 parent 5ebb953 commit 679d39e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

go/cmd/gh-ost/main.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,15 @@ func main() {
160160
flag.PrintDefaults()
161161
return
162162
}
163+
164+
if AppVersion == "" {
165+
AppVersion = "unversioned"
166+
}
167+
if GitCommit == "" {
168+
GitCommit = "unknown"
169+
}
163170
if *version {
164-
appVersion := AppVersion
165-
if appVersion == "" {
166-
appVersion = "unversioned"
167-
}
168-
fmt.Printf("%s (git commit: %s)", appVersion, GitCommit)
171+
fmt.Printf("%s (git commit: %s)\n", AppVersion, GitCommit)
169172
return
170173
}
171174

0 commit comments

Comments
 (0)