ci: pin golangci-lint and align local lint with CI diff filter#515
Conversation
✅ Deploy Preview for devsydev canceled.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughPins Changesgolangci-lint v2.12.2 upgrade and local task rename
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
✅ Deploy Preview for images-devsy-sh canceled.
|
Pre-commit pinned an older golangci-lint (v2.11.4) and ran without the diff filter that CI applies, so violations introduced by a patch could pass locally and fail in CI. Match versions, mirror the --new-from-rev=origin/main filter in the hook, and rename the Taskfile target to cli:lint:ci so "did I match CI?" is a single command.
7ddf0c8 to
09812a5
Compare
Summary
Local lint and CI lint disagreed because of two things, both addressed here:
golangci-linttov2.11.4; CI usedlatest(currently resolved tov2.12.2). Linter rules and thresholds shift across versions, so the same code could pass one and fail the other.cli:lint:newwas close, but the name didn't make the parity intent obvious.Changes
.github/workflows/pr-ci.yml— pingolangci-lintfromlatesttov2.12.2. CI no longer drifts when upstream releases..pre-commit-config.yaml— bump pinned versionv2.11.4 -> v2.12.2to match CI exactly.Taskfile.yml— replacecli:lint:newwithcli:lint:ci(clearer name, same command). Runtask cli:lint:cifor an explicit "did I match CI?" check.Why no
--new-from-revin pre-commitInitially attempted, but
actions/checkout@v6defaults to a shallow fetch that doesn't includeorigin/main, so--new-from-rev=origin/maincouldn't resolve in the precommit job and golangci-lint fell back to all-issues mode, surfacing 15 pre-existingunparamviolations introduced by the v2.11.4→v2.12.2 detection improvements. The Taskfile target gives developers the diff-filter on demand without breaking pre-commit.Summary by CodeRabbit