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

Add version flag #76

Merged
merged 1 commit into from
Jul 27, 2024
Merged

Add version flag #76

merged 1 commit into from
Jul 27, 2024

Conversation

lucacome
Copy link
Contributor

Adds -version flag.

Closes #25

@lucacome
Copy link
Contributor Author

@ahmetb any thoughts on this?

main.go Outdated
commitHash, commitTime, dirtyBuild := getBuildInfo()
arch := fmt.Sprintf("%v/%v", runtime.GOOS, runtime.GOARCH)

fmt.Printf("gen-crd-api-reference-docs version=%s commit=%s date=%s dirty=%v arch=%s go=%v\n", version, commitHash, commitTime, dirtyBuild, arch, runtime.Version())
Copy link
Owner

Choose a reason for hiding this comment

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

Should we move this inside the if?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking that it would be useful to always print the version at startup, but happy to move it.

Copy link
Owner

Choose a reason for hiding this comment

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

I forgot how much output the program prints. If it's very little, it might get annoying.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it would be something like

❯ gen-crd-api-reference-docs -config site/config/api/config.json -template-dir site/config/api -out-file site/content/reference/api.md -api-dir "github.com/nginxinc/nginx-gateway-fabric/apis"
gen-crd-api-reference-docs version=0.3.0-SNAPSHOT-62fa6e2 commit=62fa6e27a07bac0cf553ec35ab52736d3a58a5e6 date=2024-07-24T22:16:31Z dirty=false arch=darwin/arm64 go=go1.22.5
I0724 19:01:55.984928   60449 main.go:144] parsing go packages in directory github.com/nginxinc/nginx-gateway-fabric/apis
I0724 19:02:00.058290   60449 main.go:246] using package=github.com/nginxinc/nginx-gateway-fabric/apis/v1alpha1
I0724 19:02:00.070753   60449 main.go:182] written to site/content/reference/api.md

Copy link
Owner

Choose a reason for hiding this comment

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

Ehh looks a bit wonky especially since we use klog for the rest of the output. Let's move inside "if" IMO if you don't mind. 🤞

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Luca Comellini <[email protected]>
@ahmetb ahmetb merged commit 819de22 into ahmetb:master Jul 27, 2024
1 check passed
@lucacome lucacome deleted the add-release-flag branch July 27, 2024 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a --version flag to the binary
2 participants