Repository navigation
✨ Add a --version option to controller-gen - #332
Conversation
|
Welcome @dlespiau! |
0dfb910 to
327cb3e
Compare
|
/assign @droot |
droot
left a comment
There was a problem hiding this comment.
Thanks for submitting the PR (I was about to start work on it :))
Looks good. One minor comment.
| func Print() error { | ||
| v, err := version() | ||
| if err != nil { | ||
| return err |
There was a problem hiding this comment.
Looks like nothing will get printed for the end-user. We should probably print Version: Unknown in this case.
|
Also, can you pl. update the commit and PR as per our template --> https://raw.githubusercontent.com/kubernetes-sigs/controller-tools/master/.github/pull_request_template.md |
|
I took another look and feel that we can simplify the version function by not returning error. In case of error, we simply return "unknown" version. |
It's useful to know the version of a controller-gen binary lying around. With this, we can write checks in the kubebuilder Makefile to upgrade controller-gen when needed, or at least warn about it.
327cb3e to
6eef398
Compare
|
The error was propagated and displayed by the main program explaining why the version coud not be displayed (not compiled with go modules). But I see the point: may as well always display a "Version: .*" string that can be parsed in always the same way. One detail is that the go runtime with return version |
Sounds good to me. |
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: dlespiau The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
It's useful to know the version of a
controller-genbinary lying around. We could write checks in the kubebuilderMakefileto upgradecontroller-genwhen needed, or at least warn about it.Fixes: #259
I checked that this indeed worked with main modules when using
go get: https://github.com/dlespiau/go-main-module-version.