fix(build): run golangci-lint via go run, unbreak make janitor - #1170
Merged
Merged
Conversation
'make janitor' failed with: can't load config: the Go language version (go1.26) used to build golangci-lint is lower than the targeted Go version (1.27.0) The v2 migration (#1166) moved the config but left the Makefile and the pre-commit hook calling whatever golangci-lint sits in $PATH. Building it with 'go run' means the local toolchain always matches go.mod. Also: - --disable-all -E misspell -> --enable-only misspell (v2 dropped the former) - gosec: skip the gitignored old/ scratch directory, which breaks its package loading - govulncheck: ignore GO-2026-5932 by id. It has no fixed version (see #1163), so the target could never pass, and a check that always fails is a check nobody runs. Any other advisory still fails the target, verified by temporarily changing the ignored id. Renovate's custom manager now covers the pre-commit config too, so both pinned versions keep updating. Co-Authored-By: Claude Fable 5 <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.
make janitorwas broken:My miss in #1166: that PR migrated the config to v2 but left the Makefile and the pre-commit hook invoking whatever
golangci-linthappens to be in$PATH— still v1.64.8 built with Go 1.26 here. Building the linter withgo runmeans the local toolchain compiles it, so it always targets the same Go version as go.mod.Four fixes, each found by actually running the target until it exited 0:
go run(pinned@v2.13.1, like GOSEC/GOFUMPT/GOVULNCHECK), in both the Makefile and.pre-commit-config.yaml. The pre-commit hook had the identical problem — it is skipped on pre-commit.ci, so it only ever failed locally.--disable-all -E misspell→--enable-only misspell— v2 removed the old flag pair.-exclude-dir=old— the gitignoredold/scratch directory contains a second module and broke gosec's package loading (found packages openers and main in old/magnet).x/crypto/openpgpadvisory reaching us through go-selfupdate, and it has no fixed version (govulncheck GO-2026-5932: x/crypto/openpgp (unmaintained) linked via go-selfupdate #1163) — so the target could never pass, and a check that always fails is a check nobody runs. Any other advisory still fails the build.On that last point, I verified the guard rather than trusting it: temporarily changing the ignored id makes
make janitorexit non-zero on the very same advisory, and restoring it exits 0. (Amusing detail: my first interactive test of the grep logic gave inverted results because this shell wrapsgrepin a function —makeuses/bin/sh, and against the real/usr/bin/grepthe three cases behave as designed.)Renovate's custom manager now watches
.pre-commit-config.yamlas well as the Makefile, so both pinned versions keep updating.Verified:
make janitorexits 0, running golangci-lint (0 issues), gofumpt, gosec (0 issues) and govulncheck end to end;pre-commit run golangci-lint --all-filespasses; renovate config validates against v43.🤖 Generated with Claude Code