Repository navigation
Make the linter able to read Go 1.27 code, and fail loudly when it cannot - #57
Merged
Merged
Conversation
…nnot CI installs Go `stable`, which moved to 1.27.1. golangci-lint v2.12.2 is built with Go 1.26 and cannot type-check the 1.27 standard library, so it reported two errors in math/rand/v2 instead of the real findings, and continue-on-error hid that the linter had stopped working. v2.14.0 is built with Go 1.27.0. A new step compares the Go the linter was built with against the toolchain and fails the job when the toolchain is newer, so the next Go release cannot silence the linter without anyone noticing. The findings themselves stay advisory (#8), and the comment now points at #8 instead of #1. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Actions runs this step with bash -e and no pipefail. If the lint action failed to install the binary, the version came back empty, the numeric test errored, and if treated that as false, so the guard passed. It now passes only when it can read both versions and the linter's is at least as new. Comments now match the findings and the original errors. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
What this changes
The lint step has not linted anything since GitHub's
stableGo moved to 1.27.1. golangci-lint v2.12.2 is built with Go 1.26 and cannot type-check the 1.27 standard library. Every run onmainreported the same two errors, both in the Go install'scrypto/internal/randutilfailing to importmath/rand/v2, and no findings from our code.continue-on-errorkept the job green, so nothing showed it.continue-on-error, so the next Go release turns this job red instead of silently switching the linter off. The fix then is a one-line version bump.The findings stay advisory, as agreed in #8. Run locally with v2.14.0 there are 135, of which 133 are errcheck, one ineffassign (
internal/agent/local/proxy.go:205) and one staticcheck S1016 (internal/agent/local/host.go:55).Trade-off to know about
When a new Go release reaches
stablebefore golangci-lint ships a build for it, every PR's "Lint + unit tests" check goes red until the version here is bumped. That is deliberate, since a green check while the linter cannot read the code is the bug this fixes. If that is too strict, the guard can print a warning instead of failing.How it was verified
ci.yamland run underbash -e, which is what Actions uses for arun:step with noshell:(no pipefail). A fakegodrives 8 cases. It passes when the linter's Go matches or is newer, including a patch difference and aX:boringcryptosuffix. It fails when the toolchain is newer (go1.28.0, go1.28rc1), when golangci-lint is not installed, and when either version cannot be read.ifread that as false. That is the silent failure this step exists to catch. It is fixed in the second commit, and the 8 cases above failed 3 of 8 before it.golangci-lint built with go1.27.0, toolchain go1.27.1. Onmainthe same step reports only the 2 standard library errors.Refs #8
🤖 Generated with Claude Code