Repository navigation
ci(deadcode): let the tool install fetch the toolchain it needs - #894
Merged
Merged
Conversation
golang.org/x/tools v0.50.0, released 2026-09-08, requires Go >= 1.26.0. go.mod declares go 1.25.9 and actions/setup-go pins GOTOOLCHAIN=local, so since that release the install step of the deadcode job fails before any analysis runs: go: golang.org/x/tools/cmd/deadcode@latest: golang.org/x/tools@v0.50.0 requires go >= 1.26.0 (running go 1.25.9; GOTOOLCHAIN=local) Every pull request opened or updated since then carries a red deadcode check for this reason alone. GOTOOLCHAIN=auto on that one step lets the go command fetch the toolchain the tool needs in order to build. The analysis step is untouched and still runs under the Go version go.mod declares. Reproduced locally with Go 1.25.9: the install fails under GOTOOLCHAIN=local, succeeds under GOTOOLCHAIN=auto (switching to go1.26.8), and the resulting binary reports no dead code in ./cmd/allstar/... Signed-off-by: Eljees <57435526+Eljees@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The narrowly scoped CI change resolves installation failures without altering analysis behavior.
Review effort: Lite
Findings: None
What changed in this PR
Updates the deadcode CI installation to support required newer Go toolchains.
Changes:
- Enables
GOTOOLCHAIN=autoduring installation. - Keeps analysis on the repository’s declared Go version.
| File | Description |
|---|---|
.github/workflows/pr.yaml |
Enables automatic toolchain selection for deadcode installation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
What is red
Every pull request whose
deadcodejob has run since 2026-09-08 fails at the install step, before any analysis happens:golang.org/x/toolsv0.50.0 was published on 2026-09-08 and raised its owngodirective to 1.26.0. The job installs the tool with@latest, whileactions/setup-gotakes the Go version fromgo.mod(1.25.9) and setsGOTOOLCHAIN=local(the setting that forbids the go command from fetching another toolchain), which turns "this module wants a newer toolchain" into a hard error.Why this is repo-wide rather than anything in one branch
deadcodeconclusions on the most recently updated pull requests, ordered by when the check actually ran:godirective on that head#889 fails the same way, at 2026-09-10 02:13 UTC.
Every run that happened before the v0.50.0 release is green and every run after it is red. The single exception points at the cause: #890 bumps
golang.org/x/syncand raises thegodirective to 1.26.0 along the way, and itsdeadcodejob passed one minute after #891 failed. The content of the branches has nothing to do with it; #892 touches only two workflow files.The change
GOTOOLCHAIN=autoon the install step alone, so the go command may fetch the toolchain that building the tool requires. The analysis step is untouched and still runs under the Go version thatgo.moddeclares. Thedeadcodecheck on this pull request is the first green one since the release.Reproduction, before CI confirmed it
With Go 1.25.9 locally, the same version the job installs:
Alternative, if you prefer it
Pinning the tool instead,
go install golang.org/x/tools/cmd/deadcode@v0.49.0, also clears the failure and keeps every toolchain at the versiongo.moddeclares, at the price of a pin that nothing bumps automatically. Say the word and I will switch this pull request over to that.