Skip to content

Run the golangci-lint pre-commit hook from PATH - #9

Merged
arcaputo3 merged 1 commit into
mainfrom
chore-precommit-golangci-system
Aug 5, 2026
Merged

Run the golangci-lint pre-commit hook from PATH#9
arcaputo3 merged 1 commit into
mainfrom
chore-precommit-golangci-system

Conversation

@arcaputo3

Copy link
Copy Markdown
Contributor

Why

The upstream golangci-lint pre-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:

can't load config: the Go language version (go1.25) used to build golangci-lint
is lower than the targeted Go version (1.26)

Every commit fails the hook, so the only way through is --no-verify.

What

Run the golangci-lint already on PATH — the same binary CLAUDE.md tells you to invoke by hand — instead of the source build. Pinning language_version: '1.26.2' would also work but forces every contributor to download a second Go toolchain.

CLAUDE.md gains the one-line install so a fresh clone knows what to put on PATH.

CI is unaffected: it pins v2.12.0 through golangci/golangci-lint-action@v7 and never touches pre-commit.

Verification

$ pre-commit run --all-files
golangci-lint............................................................Passed
go test..................................................................Passed

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

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>
@arcaputo3
arcaputo3 merged commit ad694a1 into main Aug 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant