Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix --version output #1352

Merged
merged 2 commits into from
Dec 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}

Copy link
Collaborator Author

@timvaillancourt timvaillancourt Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's always fallback to unversioned/unknown so that the starting gh-ost %+v logline later also gets this fallback instead of ""

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
Loading