Skip to content

chore: add check-latest to setup-go for reliable Go version resolution - #527

Closed
Shelnutt2 wants to merge 1 commit into
mainfrom
update-go-1.26.5
Closed

chore: add check-latest to setup-go for reliable Go version resolution#527
Shelnutt2 wants to merge 1 commit into
mainfrom
update-go-1.26.5

Conversation

@Shelnutt2

@Shelnutt2 Shelnutt2 commented Jul 15, 2026

Copy link
Copy Markdown

Problem

Our CI workflows use go-version: "1.26" with actions/setup-go@v6, which is intended to resolve to the latest Go 1.26.x patch. However, setup-go defaults to check-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.mod required a patch version newer than what was cached on the runner:

Found in cache @ /opt/hostedtoolcache/go/1.26.4/x64
...
go: go.mod requires go >= 1.26.5 (running go 1.26.4; GOTOOLCHAIN=local)

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: true to all actions/setup-go@v6 steps. 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:

Attempting to resolve the latest version from the manifest...
matching 1.26...
Resolved as '1.26.5'

@denisra
denisra force-pushed the update-go-1.26.5 branch 2 times, most recently from 9a1b7d5 to 6573a46 Compare July 16, 2026 12:52
@denisra denisra changed the title chore: update Go from 1.26.0 to 1.26.5 chore: update Go 1.26.0 → 1.26.5, add check-latest to setup-go Jul 16, 2026
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.
@denisra denisra changed the title chore: update Go 1.26.0 → 1.26.5, add check-latest to setup-go chore: add check-latest to setup-go for reliable Go version resolution Jul 16, 2026
@denisra
denisra force-pushed the update-go-1.26.5 branch from 6573a46 to d850e0a Compare July 16, 2026 13:06
@denisra
denisra requested a review from Copilot July 16, 2026 13:22
@denisra denisra self-assigned this Jul 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: true to all actions/setup-go@v6 steps 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
johnstcn previously approved these changes Jul 16, 2026

@johnstcn johnstcn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@johnstcn
johnstcn dismissed their stale review July 16, 2026 14:27

not seth

@denisra denisra closed this Jul 16, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants