Repository navigation
ci: declare the golangci-lint version in one place - #18
Merged
Merged
Conversation
The Lint job pinned golangci-lint to v2.11.4 through the action's version input while install-go-tools.sh, used by the Pre-commit job, pinned v2.13.2. Both jobs lint every pull request, so the same commit was checked by two different linter builds whose findings can diverge. Install the tools with the same script the Pre-commit job uses and set install-mode to none so the action runs the binary already on PATH. In that mode the version input is ignored, leaving the script as the only place the version is declared. Caching and annotations are unchanged. Assisted-by: Kiro <noreply@kiro.dev> (1.0.116)
Nothing in a local checkout declared which golangci-lint version the repository expects, so a developer's system package could differ from the version CI installs and report a different set of findings. The pre-commit hook then fails in CI after passing locally, or passes in CI after failing locally. Wire the existing install-go-tools.sh into the Makefile so a local checkout installs the same pinned versions CI does. Assisted-by: Kiro <noreply@kiro.dev> (1.0.116)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three places decided which
golangci-lintran, and they disagreed:.github/workflows/lint.yml(actionversion:input)v2.11.4.github/scripts/install-go-tools.sh(Pre-commit job)v2.13.2Both CI jobs lint every pull request, so one commit was checked by two
different linter builds whose findings can diverge.
After this change
install-go-tools.shis the only declaration:lint.ymlrunsinstall-go-tools.sh, then passesinstall-mode: nonetothe action. In that mode the action ignores
version:and runs thegolangci-lintalready onPATH— the script appendsGOPATH/binto$GITHUB_PATH, which applies to subsequent steps. The action's caching andannotations are unaffected.
make toolsruns the same script, giving a local checkout a supported way toinstall the versions the repository expects.
Verification
check yamlpasses onlint.yml.make helpliststools;make -n toolsresolves to.github/scripts/install-go-tools.sh..github/,Makefile, and.pre-commit-config.yamlconfirmsGOLANGCI_LINT_VERSIONininstall-go-tools.shis the only remainingversion declaration.
install-mode: noneresolves the binary from$GITHUB_PATH. That needs a CI run on this PR.Notes
Scope and triggers are unchanged — the
Lintjob still runs the full module onevery push and pull request. Delta linting stays exclusive to the pre-commit
path (#17).