ci: build golangci-lint with go.mod's toolchain (fixes red main) - #28
Merged
Merged
Conversation
setup-go installs go.mod's `go` line (1.25.x). golangci-lint v2.14.0
requires go >= 1.26, so the action's `go install` (install-mode:
goinstall), which runs outside the module, switched to go1.26.8. That
binary refuses a module whose toolchain line targets Go 1.27.1 ("the Go
language version (go1.26) used to build golangci-lint is lower than the
targeted Go version (1.27.1)"), so the lint job failed without looking
at any code.
Export GOTOOLCHAIN from go.mod's toolchain line before the lint step,
so golangci-lint is built with the same Go the module targets and the
value cannot drift from go.mod.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GKRxaeYxyDhmt42cehLsGA
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
mainhas been red since #26 (Go 1.27.1). The BFF golangci-lint job fails before it reads any code:Cause:
setup-gowithgo-version-file: bff/go.modinstalls thegoline, which is 1.25.install-mode: goinstall) runsgo installoutside the module, so Go switches to the oldest toolchain golangci-lint v2.14.0 accepts, which is go1.26.8.toolchainline is go1.27.1.Fix: a step before the lint action exports
GOTOOLCHAINfrombff/go.mod'stoolchainline. golangci-lint is then built with the Go the module targets, and the value is read from go.mod, so the two can't drift apart.Verification (local)
GOTOOLCHAINtaken frombff/go.mod(go1.27.1), golangci-lint v2.14.0 builds with go1.27.1.mainand on feat: access-policy editor (A4, part 3) #27's head (8e86996). feat: access-policy editor (A4, part 3) #27's red lint check is caused by the same problem. It should go green once this is merged and feat: access-policy editor (A4, part 3) #27 is updated frommain.🤖 Generated with Claude Code
https://claude.ai/code/session_01GKRxaeYxyDhmt42cehLsGA
Generated by Claude Code