-
Notifications
You must be signed in to change notification settings - Fork 79
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
Kubernetes 1.32 libraries #650
Conversation
/retest |
Makefile
Outdated
lint: "$(MYGOBIN)/golangci-lint" | ||
"$(MYGOBIN)/golangci-lint" run ./... | ||
lint: | ||
go run github.com/golangci/golangci-lint/cmd/[email protected] run ./... |
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.
Why condense this and not just bump the version in the other command?
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 recently had an issue where some project (not cli-utils) installed an old version of golangci-lint into my GOBIN and it was crashing. I thought I'm using the brew-managed version but then found out that I'm not.
There is no need to install it, we can just go run
the required version and avoid any clashes with what the user has installed. I can undo this change if you prefer to keep it as-is, but go run
is more hermetic vs go install
.
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 think my preferred solution for this is larger than we would want in this PR, but if you want to tackle it in another PR, I'd take it.
What we do in the kpt-config-sync repo is go install into an gitignored /.output/go/bin/ directory inside the repo using a GOPATH passed to the go install command. Then the binary can be executed directly using the $(GOBIN)/binary-name alias in the makefile.
Either way tho, I would suggest just updating the version in this PR to minimize other changes.
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.
- https://github.com/GoogleContainerTools/kpt-config-sync/blob/main/Makefile#L74-L76
- https://github.com/GoogleContainerTools/kpt-config-sync/blob/main/Makefile#L417-L426
- https://github.com/GoogleContainerTools/kpt-config-sync/blob/main/Makefile#L376-L378
- https://github.com/GoogleContainerTools/kpt-config-sync/blob/main/Makefile#L242-L250
It's a little convoluted, but the Makefile basically adds the repo-local GOBIN
in front of the PATH
and also sets GOLANGCI_LINT
to the path of the binary. So you can call the binary raw in scripts and still use "$(GOLANGCI_LINT)"
as a make target dependency to make sure it got installed first. Then since it's not on the regular PATH, it doesn't affect any other projects.
We should probably do something similar here.
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 decided that it'd be easier to just bump the version vs refactoring things even further.
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.
/lgtm
Thanks!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ash2k, karlkfi 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 |
No description provided.