Skip to content

chore: pin golangci-lint via .tool-versions and tune goconst config#404

Merged
Davidnet merged 2 commits into
mainfrom
chore/golangci-goconst-config
May 7, 2026
Merged

chore: pin golangci-lint via .tool-versions and tune goconst config#404
Davidnet merged 2 commits into
mainfrom
chore/golangci-goconst-config

Conversation

@Davidnet
Copy link
Copy Markdown
Member

@Davidnet Davidnet commented May 7, 2026

Summary

  • Tune goconst config in .golangci.yml:
    • ignore-tests: true so 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.
  • Replace mise.toml with .tool-versions as a single source of truth for go and golangci-lint versions.
  • Wire the CI golangci-lint-action to version-file: .tool-versions so CI and local stay in sync (without this, the action defaults to installing latest).

Result: golangci-lint run goes from 11 issues to 0 with no production source changes, and the linter version is pinned identically locally and in CI.

Test plan

  • mise install picks up go 1.25.6 and golangci-lint 2.12.2 from .tool-versions
  • mise exec -- golangci-lint run reports 0 issues
  • CI Go Lint job uses golangci-lint 2.12.2

Copilot AI review requested due to automatic review settings May 7, 2026 16:17
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 remove mise.toml to consolidate version pinning.
  • Update .golangci.yml goconst settings (ignore-tests, ignore-string-values).
  • Configure the GitHub Actions golangci-lint-action to use .tool-versions via version-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.

Davidnet added 2 commits May 7, 2026 11:21
- 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.
@Davidnet Davidnet force-pushed the chore/golangci-goconst-config branch from c78371a to 0185ab9 Compare May 7, 2026 16:21
@Davidnet Davidnet merged commit e6a0ccf into main May 7, 2026
6 of 8 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants