-
Notifications
You must be signed in to change notification settings - Fork 15
BE-730 | golangci-lint use toolchain of current go.mod version #650
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
WalkthroughThe Makefile was updated to introduce a new variable, Changes
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
Makefile (2)
11-12
: Validate and robustly extract Go versionThe current extraction using
cat
and a broad regex may match unintended lines and incurs an extra subshell. Consider anchoring the pattern and avoidingcat
:-GO_VERSION := $(shell cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2) +GO_VERSION := $(shell grep -E -m1 '^go [0-9]+\.[0-9]+' go.mod | cut -d ' ' -f 2)Also ensure that any environment (CI or local) where this Makefile runs has the corresponding
go$(GO_VERSION)
binary installed, since it's referenced later in the lint target.
60-62
: Verify golangci-lint support for GOTOOLCHAIN env varThis change relies on
golangci-lint
recognizing theGOTOOLCHAIN
environment variable (per golangci/golangci-lint#5695). Please confirm that your CI and dev environments use a compatiblegolangci-lint
version; otherwise, the toolchain override will be ignored.Optionally, to fail early if the specified Go binary is missing, you could add:
lint: @echo "--> Running linter" + @if ! command -v $(GOTOOLCHAIN) >/dev/null 2>&1; then \ + echo "Error: Go toolchain '$(GOTOOLCHAIN)' not found"; \ + exit 1; \ + fi GOTOOLCHAIN=$(GOTOOLCHAIN) golangci-lint run --timeout=10m
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
Makefile
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Run linter
- GitHub Check: build
- GitHub Check: Summary
|
Older versions of golangci-lint has some memory leaks when running with newer Go versions leading consuming all available RAM and crashing, context.
This PR forces to use same Go version for
golangci-lint
as in the module ( go.mod ).Summary by CodeRabbit