Repository navigation
Description
Problem
Both scan lanes select a Go toolchain from the project's go.mod, and go.mod carries two version directives:
go 1.23.0
toolchain go1.25.3
actions/setup-go v6 onwards prefers toolchain where present and falls back to go. Getting that precedence wrong is not a soft failure: setup-go exports GOTOOLCHAIN=local, so Go refuses to fetch the toolchain the module asks for and stops with
go: go.mod requires go >= 1.25.3 (running go 1.23.0; GOTOOLCHAIN=local)
lfreleng-actions/test-go-project, the fixture both lanes' Go legs scan, declares only:
module github.com/lfreleng-actions/test-go-project
go 1.25
No toolchain directive. So no self-test in this repository exercises toolchain selection at all, in either lane, in either scan mode.
Why this is not hypothetical
The CLM lane shipped with exactly this defect from PR #38 until #76. It passed build-metadata-action's go_go_version — documented as the go directive — as setup-go's go-version, which beats go-version-file outright, so the file was never read and toolchain never applied. Every Go self-test passed throughout, because the fixture has nothing to get wrong.
That is the same shape as #74: a silent-by-construction failure mode with no fixture able to surface it. The difference is that this one fails loudly in production while passing in CI — the fixture is what makes it invisible, not the failure itself.
Proposal
Give the estate a Go fixture whose go.mod carries a toolchain directive newer than its go directive, so the two resolve to observably different versions.
Two placements, both defensible:
- Add the directive to
lfreleng-actions/test-go-project. Cheapest, and makes every consumer's Go path more representative. But that fixture is shared withgo-workflowsand others, so the change needs their sign-off — it would raise the minimum Go those jobs install. - Add a sibling fixture (
test-go-toolchain-project, or a branch of the existing one) used only where toolchain selection is under test. No blast radius, one more repository to keep current.
Then assert the resolved version, not merely that the job completed: a run that installs the go directive's version and succeeds anyway proves nothing, since most modules build fine on either.
Acceptance
- A fixture exists whose
goandtoolchaindirectives resolve to different versions - Both lanes' Go legs scan it
- The check fails if the
godirective's version is installed instead of thetoolchainone - Ideally also covered with
GOTOOLCHAIN=localpreset, which flips setup-go back to thegodirective
Related
- No submodule-bearing fixture, so submodule scanning is untested #74 — the same class of gap for submodules
- Fix: Honour go.mod toolchain and wire Sonar coverage #76 — the fix this issue exists to have caught
Raised while fixing the toolchain precedence in #76.
Activity
Docs: Record the Go toolchain and coverage decisions
ModeSevenIndustrialSolutions commentedon Sep 1, 2026
The fixture half of this is now up as lfreleng-actions/test-go-project#81, and the consuming assertion as #82.
What each part does
test-go-project#81 adds one directive:
go 1.25 +toolchain go1.25.0Option 1 from this issue — extending the existing fixture rather than adding a sibling. The concern raised here was that it "would raise the minimum Go those jobs install". It does not: the pin sits below the
godirective's resolution, not above it.toolchaindirective (correct)godirective (the regression)The
godirective is untouched, sobuild-metadata-action'sgo_go_version_matrixis unchanged and no consumer's version matrix moves. Go 1.25 has 15 published patches, so the gap is permanent and widens with each release — the check cannot decay into a false pass.security-workflows#82 publishes the resolved version from both lanes and compares each against the fixture's
go.mod, reading the directive at runtime rather than hardcoding a version.On the acceptance criteria
goandtoolchaindirectives resolve to different versionsgo-test-actionexposes none), so Feat: Expose lane outputs and assert on them #82 records the toolchain that reachedPATHafter its test stepgodirective's version is installed instead of thetoolchainone, naming which lane driftedGOTOOLCHAIN=localpreset — not covered, see belowThe one criterion left open
The final box asked for coverage with
GOTOOLCHAIN=localpreset, which flips setup-go back to thegodirective. That is deliberately not implemented, because on reflection it tests upstream behaviour rather than ours: setup-go documents the fallback, and asserting it here would pin us to an implementation detail we do not control and would have to update when it changes. If a lane ever setsGOTOOLCHAINitself the calculus changes — neither does today.Happy to add it if you disagree; it is a matrix entry, not a redesign.
A correction worth flagging
This issue's framing — and D21 as merged — described the defect as failing the scan outright. That was wrong, and #82 corrects it. Checked against Go 1.24.3: a module declaring
go 1.23.0withtoolchain go1.25.3runsgo mod tidyto completion underGOTOOLCHAIN=local, exit 0, silently ignoring the toolchain. The error I had quoted comes from thegodirective being unsatisfied, which that code path could never cause.So the real consequence was a silent downgrade rather than an outage — which is a stronger argument for this issue existing, not a weaker one. An outage would have been noticed without a fixture.
Also worth correcting: the defect was CLM-only. The Sonar lane always read
go.modthroughgo-test-action. The new assertion still guards both, since either can regress into it.Merging #81 first means a dispatch of
testing.yamlfrom #82 exercises the real assertion rather than the skip branch.Feat: Expose lane outputs so callers can assert
Test: Assert the Go toolchain the project asked for
Test: Add a distinguishable toolchain directive
ModeSevenIndustrialSolutions commentedon Sep 3, 2026
Ready to close. Both halves landed:
The fixture —
test-go-projectgained the directive in test-go-project#81:The assertion — #82, released in v0.6.0. It covers both lanes, not just the CLM one this issue was raised against:
go-test-actionreports no version, so the Sonar lane records the toolchain that reachedPATHand publishes it the same way.Because the check reads the directive from
go.modat runtime rather than comparing against a hardcoded version, it armed itself the moment the fixture merged — no follow-up change was needed here.Against the acceptance criteria
goandtoolchaindirectives resolve to different versions —1.25.0versus the latest 1.25.x, permanently distinct and widening with each patch releasegodirective's version is installed instead, naming which lane driftedGOTOOLCHAIN=localpresetOn the last box: I left it deliberately. It asserts
setup-go's own documented fallback rather than anything this repository controls, so it would pin us to an upstream implementation detail and need updating when that changes. If a lane ever setsGOTOOLCHAINitself the calculus flips — neither does today. Happy to add it as a matrix entry if you disagree.Worth a dispatch before the next release
testing.yamlhas not run since the fixture merged, soassert-go-toolchainhas never executed its real comparison — until now it took the warn-and-skip branch, by design. The first dispatch is what confirms the whole chain end to end.Also worth noting the correction this work produced: D21 originally described the defect as failing the scan outright, which was wrong. Verified against Go 1.24.3, it is a silent downgrade — the scan builds on the older Go and reports success. That makes this fixture more necessary rather than less, since an outage would have been noticed without one.
Related: #74 remains open for the equivalent submodule gap.
ModeSevenIndustrialSolutions commentedon Sep 14, 2026
Both halves of this now exist; closing
The issue asks for a Go fixture carrying a
toolchaindirective, so the lane's version selection is actually exercised rather than assumed.The fixture has one.
lfreleng-actions/test-go-projectatmain:Two directives that disagree in kind is the whole point:
toolchainoutranksgo, and a lane passing a version as setup-go'sgo-versionwould suppress the file and silently select the wrong one.The assertion exists.
testing.yamlcarriesassert-go-toolchain, gated on both lanes' Go legs plus the fixture ref, so it compares what each lane resolved against what the file declares rather than trusting either in isolation.That closes the gap D21 was written about — the defect it records was a silent downgrade, exit 0 with nothing said, which is precisely the failure a fixture without a
toolchaindirective cannot catch.One caveat worth recording rather than leaving implicit:
testing.yamlisworkflow_dispatch-only and needs org credentials, so the assertion runs when someone dispatches it, not on every PR. The coverage exists; it is not continuous.Docs: Correct figures and stale lfreleng-actions#75 references
Docs: Correct figures and stale lfreleng-actions#75 references
Docs: Correct figures and stale lfreleng-actions#75 references
Docs: Correct figures and stale lfreleng-actions#75 references
Docs: Correct figures and stale lfreleng-actions#75 references
Docs: Correct figures and stale lfreleng-actions#75 references
Docs: Correct figures and stale lfreleng-actions#75 references
Fix: Move fixture to supported Go 1.26