-
Notifications
You must be signed in to change notification settings - Fork 99
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
Add version flag #76
Conversation
32c4fc2
to
f50c4b2
Compare
f50c4b2
to
dfb1db9
Compare
@ahmetb any thoughts on this? |
dfb1db9
to
62fa6e2
Compare
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()) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. 🤞
There was a problem hiding this comment.
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]>
62fa6e2
to
d24cff6
Compare
Adds
-version
flag.Closes #25