Run the golangci-lint pre-commit hook from PATH - #9
Merged
Conversation
The upstream golangci-lint pre-commit repo builds the linter from source with whatever Go toolchain it resolves. When that is older than 1.26 the resulting binary refuses to load this config at all: can't load config: the Go language version (go1.25) used to build golangci-lint is lower than the targeted Go version (1.26) Pinning language_version would fix it but forces every contributor to download a second toolchain. Use the golangci-lint already on PATH instead — the same binary CLAUDE.md tells you to run by hand — and document the install line. CI is unaffected; it pins v2.12.0 via golangci-lint-action. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Why
The upstream
golangci-lintpre-commit repo builds the linter from source using whatever Go toolchain it resolves. When that toolchain predates 1.26, the resulting binary refuses to load this repo's config at all:Every commit fails the hook, so the only way through is
--no-verify.What
Run the
golangci-lintalready onPATH— the same binaryCLAUDE.mdtells you to invoke by hand — instead of the source build. Pinninglanguage_version: '1.26.2'would also work but forces every contributor to download a second Go toolchain.CLAUDE.mdgains the one-line install so a fresh clone knows what to put onPATH.CI is unaffected: it pins v2.12.0 through
golangci/golangci-lint-action@v7and never touches pre-commit.Verification
This is the base of a stack that clears the five open issues (#4 → #6 → #5 → #7 → #8); it lands first because nothing else can be committed with hooks on.
🤖 Generated with Claude Code