Skip to content

ci: build golangci-lint with go.mod's toolchain (fixes red main) - #28

Merged
ovander merged 1 commit into
mainfrom
ci/lint-go-toolchain
Sep 28, 2026
Merged

ovander merged 1 commit into
mainfrom
ci/lint-go-toolchain

Conversation

@ovander

@ovander ovander commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Summary

main has been red since #26 (Go 1.27.1). The BFF golangci-lint job fails before it reads any code:

go: github.com/golangci/golangci-lint/v2@v2.14.0 requires go >= 1.26.0; switching to go1.26.8
Error: can't load config: the Go language version (go1.26) used to build golangci-lint is lower than the targeted Go version (1.27.1)

Cause:

  1. setup-go with go-version-file: bff/go.mod installs the go line, which is 1.25.
  2. The lint action (install-mode: goinstall) runs go install outside the module, so Go switches to the oldest toolchain golangci-lint v2.14.0 accepts, which is go1.26.8.
  3. That binary refuses a module whose toolchain line is go1.27.1.

Fix: a step before the lint action exports GOTOOLCHAIN from bff/go.mod's toolchain line. 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)

🤖 Generated with Claude Code

https://claude.ai/code/session_01GKRxaeYxyDhmt42cehLsGA


Generated by Claude Code

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
@ovander
ovander merged commit a1c39ba into main Sep 28, 2026
6 checks 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.

2 participants