Repository navigation
ci: test latest two Go releases explicitly - #329
Conversation
Default the shared build and CodeQL matrices to Go 1.26.x and 1.27.x, selecting the latest patch of each series. Allow callers to override the matrix through a JSON go-versions input. Disable automatic toolchain switching and print the selected compiler so matrix labels reflect the versions actually used for validation. Keep module requirements and dependencies unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3a297bdb-d8ae-492d-bae7-d555afa73630 Signed-off-by: cshung <3410332+cshung@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the shared build and CodeQL workflow updates that make Go toolchain selection explicit.
No open issues 🎉
What changed in this PR
Updates the shared build and CodeQL workflows to explicitly test Go 1.26 and 1.27, preventing automatic toolchain switching from masking which compiler each job uses. Callers inherit the new defaults without changes to module requirements or production code.
Changes:
- Default both matrices to
1.26.xand1.27.x, retain latest-patch selection, and add an optional JSONgo-versionsoverride. - Set
GOTOOLCHAIN=localso incompatible module requirements fail rather than silently switching compilers. - Log the effective Go version, toolchain setting, and GOROOT before testing or analysis.
| File | Description |
|---|---|
.github/workflows/reusable-codeql.yml |
Adds configurable Go versions, disables toolchain switching, and logs toolchain details before analysis. |
.github/workflows/reusable-build.yml |
Applies the same matrix controls and toolchain diagnostics to unit-test jobs. |
Review effort: Balanced
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #329 +/- ##
==========================================
+ Coverage 92.60% 94.96% +2.36%
==========================================
Files 30 30
Lines 1947 1947
==========================================
+ Hits 1803 1849 +46
Misses 98 98
+ Partials 46 0 -46 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Test the latest stable Go release and the previous release explicitly in the
shared build and CodeQL workflows: currently Go 1.27 and Go 1.26.
1.26.xand1.27.x, retainingcheck-latest: trueso setup-go selects the latest patch of each series.go-versionsinput so callers can override the default matrix when needed.GOTOOLCHAIN=localso a matrix job cannot silently download and test a different Go version.No module minimum, dependency, JWT, or production code changes are included.
The default matrix should be rolled forward when a new stable Go series is released.
Motivation
The shared workflows currently install Go 1.23/1.24. For callers requiring a
newer compiler, automatic toolchain switching can make both jobs test the same
newer compiler while their labels still suggest older-version coverage.
For example, notaryproject/notation-go#598 installed Go 1.24 but actually ran
Go 1.26.0, hitting the switched-toolchain coverage bug
golang/go#75031.
Installing the current patch explicitly avoids relying on that old toolchain.
Because callers consume these reusable workflows via
@main, merging this PRchanges their default compiler matrix too. The version override allows an
explicit caller-specific matrix; disabling automatic switching makes incompatible
module requirements fail visibly rather than invalidating the advertised matrix.
Related work and merge order
Validation
actionlintpassed for both reusable workflows and their local build/CodeQL callers.GOTOOLCHAIN=local.GOTOOLCHAIN=local, rather than silently switching.git diff --checkpasses withcore.whitespace=cr-at-eol.GitHub-hosted workflow execution and CodeQL analysis have not been validated locally.