-
Notifications
You must be signed in to change notification settings - Fork 30
Upgrade golangci-lint from v1 to v2 #692
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
base: master
Are you sure you want to change the base?
Conversation
- Update GOLANGCI_LINT_VERSION from v1.54.2 to v2.0.2 - Update module path to use /v2/ prefix - Add .golangci.yml with version: "2" declaration for v2 compatibility Tracking: redhat-best-practices-for-k8s/telco-bot#49
WalkthroughThis PR adds GolangCI-Lint v2 support by introducing a new configuration file (.golangci.yml) and updating the Makefile to install and reference golangci-lint v2.0.2 instead of v1.54.2. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: sebrandon1 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
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: 1
🤖 Fix all issues with AI agents
In `@Makefile`:
- Line 423: The Makefile pins GOLANGCI_LINT_VERSION = v2.0.2 but hack/lint.sh
still sets VERSION=v1.54.2, causing inconsistent lint runs; update the VERSION
variable in hack/lint.sh from v1.54.2 to v2.0.2 so the script pulls the same
golangci-lint image as the Makefile (look for the VERSION= assignment near the
top of hack/lint.sh and change it to VERSION=v2.0.2).
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (2)
.golangci.ymlMakefile
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.
Files:
Makefile
🔇 Additional comments (2)
Makefile (1)
432-432: Verify prereqs still finds the v2 binary in your environments.Line 432 still checks
$(shell go env GOPATH)/bin; if CI or local dev usesGOBIN, confirm the guard and PATH align so the v2 binary is discovered and not reinstalled unnecessarily..golangci.yml (1)
1-3: Config is minimal and aligned with v2; ensure CI runs golangci-lint ≥ 2.0.Line 1 introduces
version: "2", which v1 will reject; please verify all lint invocations use the v2 binary.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
|
|
||
| CILIUM_EBPF_VERSION := v0.18.0 | ||
| GOLANGCI_LINT_VERSION = v1.54.2 | ||
| GOLANGCI_LINT_VERSION = v2.0.2 |
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.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for remaining v1 references and v1.54.2 version pins
echo "=== Searching for v1.54.2 references ==="
rg -n 'v1\.54\.2'
echo "=== Searching for v1 binary path references ==="
rg -n 'golangci-lint/cmd/golangci-lint'
echo "=== Checking Makefile for golangci-lint references ==="
rg -n -A2 -B2 'GOLANGCI_LINT' Makefile
echo "=== Looking for CI scripts that may reference golangci-lint ==="
fd -t f '(lint|ci|github)' hack/ | head -20Repository: openshift/ingress-node-firewall
Length of output: 1056
🏁 Script executed:
#!/bin/bash
# Check hack/lint.sh to understand the version impact
echo "=== Content of hack/lint.sh ==="
cat -n hack/lint.sh
echo ""
echo "=== Search for references to hack/lint.sh in CI workflows ==="
fd -t f '\.(yml|yaml)' .github/workflows/ 2>/dev/null | while read f; do
if rg -l 'hack/lint' "$f" 2>/dev/null; then
echo "Found in: $f"
rg -n 'hack/lint' "$f"
fi
done
echo ""
echo "=== Check if hack/lint.sh is referenced elsewhere ==="
rg -l 'hack/lint'Repository: openshift/ingress-node-firewall
Length of output: 813
🏁 Script executed:
#!/bin/bash
# Check if hack/lint.sh is actively maintained/referenced in Makefile targets
echo "=== Check Makefile for hack/lint.sh usage ==="
rg -n 'hack/lint' Makefile
echo ""
echo "=== Check for any documentation/comments about hack/lint.sh usage ==="
rg -B2 -A2 'hack/lint' README* 2>/dev/null || echo "No README references found"
echo ""
echo "=== Check if hack/lint.sh target exists in Makefile ==="
rg -n '^lint:' MakefileRepository: openshift/ingress-node-firewall
Length of output: 379
Update hack/lint.sh to use golangci-lint v2.0.2 to match Makefile pin.
The v1.54.2 container image reference at hack/lint.sh:6 conflicts with the v2.0.2 version pinned in Makefile:423. Since the make lint target calls hack/lint.sh, developers using that command get inconsistent linting behavior. Update VERSION=v1.54.2 to VERSION=v2.0.2 in hack/lint.sh.
🤖 Prompt for AI Agents
In `@Makefile` at line 423, The Makefile pins GOLANGCI_LINT_VERSION = v2.0.2 but
hack/lint.sh still sets VERSION=v1.54.2, causing inconsistent lint runs; update
the VERSION variable in hack/lint.sh from v1.54.2 to v2.0.2 so the script pulls
the same golangci-lint image as the Makefile (look for the VERSION= assignment
near the top of hack/lint.sh and change it to VERSION=v2.0.2).
|
@sebrandon1: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. I understand the commands that are listed here. |
Summary
/v2/prefix.golangci.ymlwith v2 version declarationChanges Made
Test plan
Tracking: redhat-best-practices-for-k8s/telco-bot#49