From b6f55156c451147855a89c0952b930e62f83aca1 Mon Sep 17 00:00:00 2001 From: Kaj Kowalski Date: Mon, 15 Jun 2026 17:31:39 +0000 Subject: [PATCH] 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. --- Taskfile.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 51bf0b3..8688825 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -265,13 +265,11 @@ tasks: desc: Modernize Go code to use modern idioms silent: true 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: - - 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" # Dependency management