chore: pin golangci-lint via .tool-versions and tune goconst config#404
Conversation
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
There was a problem hiding this comment.
Pull request overview
This PR aligns local and CI tooling by pinning golangci-lint (and Go for local dev) via .tool-versions, and reduces goconst noise by tuning its configuration so production linting isn’t affected by repetitions in test files or common JSON response keys.
Changes:
- Add
.tool-versions(Go +golangci-lint) and removemise.tomlto consolidate version pinning. - Update
.golangci.ymlgoconstsettings (ignore-tests,ignore-string-values). - Configure the GitHub Actions
golangci-lint-actionto use.tool-versionsviaversion-file.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| mise.toml | Removed in favor of .tool-versions as the version source. |
| .tool-versions | New pinned versions for go and golangci-lint for local tooling. |
| .golangci.yml | Tunes goconst behavior to reduce irrelevant findings. |
| .github/workflows/lint-and-test.yml | Pins CI golangci-lint install to .tool-versions for consistency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- ignore-tests: don't let test occurrences push production code over the goconst threshold (test files were already excluded from being reported, but their counts still leaked in) - ignore-string-values: skip 'limit' and 'success' (used as JSON response keys, not magic values worth extracting) Result: golangci-lint run goes from 11 issues to 0 with no production source changes.
Replace mise.toml with .tool-versions so both mise (locally) and the golangci-lint-action (in CI, via version-file) read from the same file. Without an explicit pin, golangci-lint-action@v9.2.0 installs 'latest', which would drift from the locally-pinned version.
c78371a to
0185ab9
Compare
Summary
goconstconfig in.golangci.yml:ignore-tests: trueso test-file repetitions don't push production code over the threshold (test files were already excluded from being reported, but their occurrences still leaked into the count).ignore-string-values: '^(limit|success)$'— these are JSON response keys, not magic values worth extracting.mise.tomlwith.tool-versionsas a single source of truth forgoandgolangci-lintversions.golangci-lint-actiontoversion-file: .tool-versionsso CI and local stay in sync (without this, the action defaults to installinglatest).Result:
golangci-lint rungoes from 11 issues to 0 with no production source changes, and the linter version is pinned identically locally and in CI.Test plan
mise installpicks upgo 1.25.6andgolangci-lint 2.12.2from.tool-versionsmise exec -- golangci-lint runreports 0 issues