ci: set GOTOOLCHAIN=auto inline for the modernize task

A task-level env: entry does not override GOTOOLCHAIN when setup-go has
already exported GOTOOLCHAIN=local job-wide, so the autofix job still
failed. Set GOTOOLCHAIN=auto inline on the modernize command itself, which
reliably overrides the inherited value and lets Go fetch the toolchain the
modernize analyzer requires.
This commit is contained in:
2026-06-15 17:31:39 +00:00
parent 0827024e75
commit b6f55156c4
+4 -6
View File
@@ -265,13 +265,11 @@ tasks:
desc: Modernize Go code to use modern idioms desc: Modernize Go code to use modern idioms
silent: true silent: true
aliases: [modern] aliases: [modern]
env:
# The modernize analyzer (shipped with gopls) may require a newer Go
# toolchain than this project targets. Allow Go to fetch it on demand
# instead of failing under GOTOOLCHAIN=local, which setup-go sets in CI.
GOTOOLCHAIN: auto
cmds: cmds:
- go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./... # The modernize analyzer (shipped with gopls) may require a newer Go
# toolchain than this project targets, so it is run with GOTOOLCHAIN=auto
# to let Go fetch the toolchain it needs on demand.
- GOTOOLCHAIN=auto go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./...
- echo "Code modernized" - echo "Code modernized"
# Dependency management # Dependency management