-
Notifications
You must be signed in to change notification settings - Fork 41k
codegen tool: resolves GOBIN via go env
#132378
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
Conversation
Welcome @bartoszmajsak! |
Hi @bartoszmajsak. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/ok-to-test |
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.
/hold
We expect GOBIN to be setup by kube::golang::setup_env
, not sure why that isn't being used here
/assign @thockin
/triage accepted |
Ping this one before code freze |
Using `go env GOBIN` to locate where codegen binaries should be installed provides a more reliable and flexible solution. - Picks up a user's custom `GOBIN` whether it's set as an environment variable or only in `go env` - Falls back to `$GOPATH/bin` if no `GOBIN` is defined This handles setups (e.g. using tools like [`mise`](https://mise.jdx.dev/lang/go.html)) where `GOBIN` is configured internally but not exported. The old lookup missed those internally-configured values and could invoke the wrong codegen binary. Signed-off-by: Bartosz Majsak <bartosz.majsak@gmail.com> Co-authored-by: Tim Hockin <thockin@google.com>
Thanks! /lgtm |
LGTM label has been added. Git tree hash: 7614b9710da31ccb174885d18d275f20c271e2f2
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bartoszmajsak, thockin The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@thockin PR is blocked b/c of |
codegen tool: resolves GOBIN via `go env`
codegen tool: resolves GOBIN via `go env`
What type of PR is this?
/kind bug
What this PR does / why we need it:
Using
go env GOBIN
to locate where codegen binaries should be installed provides a more reliable and flexible solution.GOBIN
whether it's set as an environment variable or only ingo env
$GOPATH/bin
if noGOBIN
is definedThis handles setups (e.g. using tools like
mise
) whereGOBIN
is configured internally but not exported.The old lookup missed those internally configured values and could fail if the binary isn't present in the assumed location (or worse invoke the wrong codegen binary :)).
Which issue(s) this PR is related to:
Fixes #132377
Does this PR introduce a user-facing change?