chore: add check-latest to setup-go for reliable Go version resolution - #527
chore: add check-latest to setup-go for reliable Go version resolution#527Shelnutt2 wants to merge 1 commit into
Conversation
9a1b7d5 to
6573a46
Compare
Adds check-latest: true to all actions/setup-go@v6 steps in CI workflows. Without this, setup-go uses whatever Go version is in the runner's local tool cache instead of resolving go-version: "1.26" to the latest patch from the manifest. This prevents CI failures when go.mod requires a newer patch than what's cached.
6573a46 to
d850e0a
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the repository’s GitHub Actions workflows to ensure actions/setup-go@v6 reliably resolves the latest patch release for the configured Go minor version (e.g., 1.26.x when go-version: "1.26"), avoiding CI breakages caused by stale runner tool caches.
Changes:
- Adds
check-latest: trueto allactions/setup-go@v6steps in CI workflows. - Ensures Go version resolution prefers the go-versions manifest over any matching cached toolchain on the runner.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| .github/workflows/test.yml | Adds check-latest: true to each Go setup step across test/lint/acceptance jobs to always resolve the latest 1.26.x patch. |
| .github/workflows/release.yml | Adds check-latest: true to Go setup steps so releases use the latest 1.26.x patch from the manifest. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
johnstcn
left a comment
There was a problem hiding this comment.
Docs for reference: https://github.com/actions/setup-go/blob/main/docs/advanced-usage.md#check-latest-version
It supports major (e.g., "1") and major.minor (e.g., "1.25") version selectors, always resolving to the latest matching patch release.
Problem
Our CI workflows use
go-version: "1.26"withactions/setup-go@v6, which is intended to resolve to the latest Go 1.26.x patch. However,setup-godefaults tocheck-latest: false, which means it checks the runner's local tool cache first before consulting the go-versions manifest. If a matching version exists in the cache (e.g. Go 1.26.4), it uses it immediately — even when a newer patch (e.g. 1.26.5) is available in the manifest.This caused CI failures whenever
go.modrequired a patch version newer than what was cached on the runner:More broadly, this means any future Go patch bump in the 1.26.x series could break CI until the runner images are updated with the new version — defeating the purpose of using a minor-only version spec.
Fix
Adds
check-latest: trueto allactions/setup-go@v6steps. This tells setup-go to always check the manifest for the latest matching version, even when a match exists in the local cache. With this change,go-version: "1.26"reliably resolves to the latest 1.26.x patch.Confirmed working — CI now resolves to Go 1.26.5 from the manifest: