From 0827024e75b8733bdc42e0afef59fb5b86086827 Mon Sep 17 00:00:00 2001 From: Kaj Kowalski Date: Mon, 15 Jun 2026 17:29:00 +0000 Subject: [PATCH] ci: keep modernize@latest, fetch its toolchain via GOTOOLCHAIN=auto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the earlier v0.21.0 pin. The modernize analyzer (gopls v0.22+) requires Go 1.26, which the project doesn't target yet — and bumping the module to 1.26 isn't viable because the current golangci-lint release is built with Go 1.25 and refuses to lint a newer target. Instead, let the modernize task fetch the toolchain it needs on demand via GOTOOLCHAIN=auto (setup-go pins GOTOOLCHAIN=local in CI), so we stay on the latest analyzer without touching the module's Go version. Also bump golang.org/x/image v0.34.0 -> v0.42.0 via `go get -u ./...`. --- Taskfile.yml | 9 ++++++--- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index a591d90..51bf0b3 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -265,10 +265,13 @@ 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: - # Pinned to the v0.21.x line: newer gopls (v0.22+) requires Go 1.26, but - # this project targets Go 1.25 (see go.mod). - - go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@v0.21.0 -fix -test ./... + - go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./... - echo "Code modernized" # Dependency management diff --git a/go.mod b/go.mod index fc0c5a6..285ba87 100644 --- a/go.mod +++ b/go.mod @@ -12,5 +12,5 @@ require ( require ( github.com/fumiama/imgsz v0.0.4 // indirect - golang.org/x/image v0.34.0 // indirect + golang.org/x/image v0.42.0 // indirect ) diff --git a/go.sum b/go.sum index 4060a42..96a67a4 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/fumiama/go-docx v0.0.0-20250506085032-0c30fd09304b h1:/mxSugRc4SgN7Xg github.com/fumiama/go-docx v0.0.0-20250506085032-0c30fd09304b/go.mod h1:ssRF0IaB1hCcKIObp3FkZOsjTcAHpgii70JelNb4H8M= github.com/fumiama/imgsz v0.0.4 h1:Lsasu2hdSSFS+vnD+nvR1UkiRMK7hcpyYCC0FzgSMFI= github.com/fumiama/imgsz v0.0.4/go.mod h1:bISOQVTlw9sRytPwe8ir7tAaEmyz9hSNj9n8mXMBG0E= -golang.org/x/image v0.34.0 h1:33gCkyw9hmwbZJeZkct8XyR11yH889EQt/QH4VmXMn8= -golang.org/x/image v0.34.0/go.mod h1:2RNFBZRB+vnwwFil8GkMdRvrJOFd1AzdZI6vOY+eJVU= +golang.org/x/image v0.42.0 h1:1gSs6ehNWXLbkHBIPcWztk3D/6aIA/8hauiAYtlodVY= +golang.org/x/image v0.42.0/go.mod h1:rrpelvGFt+kLPAjPM4HeWPgrl0FtafueU//e5N0qk/Q= golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o= golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec= golang.org/x/text v0.38.0 h1:sXmwo9DwP3OK9EZ7PqAdaooSGozfl/3a6/xJcbzPRhE=