Skip to content

fix(release): honor declared Go toolchain - #2435

Merged
Subserial merged 1 commit into
google:mainfrom
rksharma-owg:fix/release-toolchain-version
Sep 2, 2026
Merged

Subserial merged 1 commit into
google:mainfrom
rksharma-owg:fix/release-toolchain-version

Conversation

@rksharma-owg

Copy link
Copy Markdown
Contributor

Summary

  • let the release workflow activate the exact Go toolchain declared in go.mod
  • stop before GoReleaser if the active Go version does not match that declaration
  • keep go 1.25.0 as the module's minimum supported version

Problem

The v0.22.0 release binaries were built with Go 1.25.0 even though the module declares toolchain go1.26.6. This leaves release artifacts on an older standard library than intended and makes the repository's documented release-toolchain setting ineffective.

Root cause

#2416 replaced the dedicated .go-version file with the toolchain directive, but the release workflow retained GOTOOLCHAIN: local. actions/setup-go selects the go directive from go.mod (the minimum version), while GOTOOLCHAIN: local prevents the Go command from activating the newer declared toolchain.

Fix

Set GOTOOLCHAIN to auto for the release job so the Go command honors the pinned toolchain directive. Before GoReleaser runs, compare go env GOVERSION with the toolchain parsed by go mod edit -json and fail with an actionable mismatch if they differ.

Security considerations

This affects the trusted tag-release workflow and the provenance-bearing binaries it publishes. The change does not alter workflow permissions, token handling, or application runtime behavior. Automatic selection is still pinned to the exact toolchain in go.mod, and the new check prevents a mismatched builder from publishing. Existing v0.22.0 artifacts are not changed; the fix applies to future releases.

Validation

  • Published reproduction: go version -m crane from the v0.22.0 Linux x86_64 archive reports go1.25.0.
  • Regression check before the fix: expected=go1.26.6 actual=go1.26.5 with the workflow's GOTOOLCHAIN=local behavior.
  • Regression check after the fix: workflow_GOTOOLCHAIN=auto expected=go1.26.6 actual=go1.26.6.
  • Release-equivalent CGO_ENABLED=0 go build -trimpath ./cmd/crane/main.go; go version -m reports go1.26.6.
  • PATH="$(go env GOPATH)/bin:$PATH" ./hack/presubmit.sh — passed.
  • go test -coverprofile=/tmp/gcr-coverage-2430.txt -covermode=atomic -race ./... — passed.
  • go build ./... && go test -run=^$ ./... — passed.
  • actionlint -ignore SC2086 .github/workflows/release.yml — passed. (SC2086 findings predate this change elsewhere in the workflow.)
  • git diff --check — passed.

Compatibility

No library API, CLI behavior, module minimum Go version, artifact format, or supported platform changes. Only the Go version used to build future release binaries changes to the already-declared release toolchain.

Fixes #2430

@google-cla

google-cla Bot commented Sep 1, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Subserial

Copy link
Copy Markdown

Ah, my bad. I didn't realize we needed auto set. Once you accept the CLA I'll be able to merge the PR.

@rksharma-owg
rksharma-owg marked this pull request as ready for review September 1, 2026 21:39
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.01%. Comparing base (44f7ea3) to head (60f60a0).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2435   +/-   ##
=======================================
  Coverage   58.01%   58.01%           
=======================================
  Files         167      167           
  Lines       11596    11596           
=======================================
  Hits         6727     6727           
  Misses       4068     4068           
  Partials      801      801           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Subserial
Subserial merged commit 4b9b3c7 into google:main Sep 2, 2026
19 checks passed
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
crane 0.22.1

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## What's Changed
* Reject non-canonical IP literals in all SSRF guards by @shaggyinsomniac in google/go-containerregistry#2426
* daemon: fix stale docker/docker reference in WithClient docs by @BobDu in google/go-containerregistry#2428
* build(deps): bump the go-deps group across 2 directories with 4 updates by @dependabot[bot] in google/go-containerregistry#2422
* authn: do not overwrite AuthConfig.Auth when username and password are empty by @nileshpatil6 in google/go-containerregistry#2420
* build(deps): bump the actions group across 1 directory with 8 updates by @dependabot[bot] in google/go-containerregistry#2423
* Support pulling images by sha512 digest by @BobDu in google/go-containerregistry#2427
* Allow empty label and annotation values in crane mutate by @theadsingh in google/go-containerregistry#2418
* fix(build): Use dependencies.gitSource in cloudbuild_v2.yaml by @tprussak in google/go-containerregistry#2434
* validate: support index attestation manifests and empty configs by @Subserial in google/go-containerregistry#2414
* name: improve error when parsing a reference with a URL scheme by @locker95 in google/go-containerregistry#2431
* fix(build): install binaries to /ko-app and add to PATH (#2424) by @tprussak in google/go-containerregistry#2436
* fix(release): honor declared Go toolchain by @rksharma-owg in google/go-containerregistry#2435
* remote: apply checkRedirectSSRF to writer-side HTTP clients by @locker95 in google/go-containerregistry#2432
* flatten: preserve config and layer media types when flattening by @Subserial in google/go-containerregistry#2438
* fix(mutate): make Time layer updates lazy by @amarkdotdev in google/go-containerregistry#2429
* build(deps): bump the go-deps group across 2 directories with 3 updates by @dependabot[bot] in google/go-containerregistry#2439
* remote: copy manifest annotations to referrers fallback tag descriptors by @codysoyland in google/go-containerregistry#2441

## New Contributors
* @shaggyinsomniac made their first contribution in google/go-containerregistry#2426
* @BobDu made their first contribution in google/go-containerregistry#2428
* @nileshpatil6 made their first contribution in google/go-containerregistry#2420
* @theadsingh made their first contribution in google/go-containerregistry#2418
* @locker95 made their first contribution in google/go-containerregistry#2431
* @rksharma-owg made their first contribution in google/go-containerregistry#2435
* @codysoyland made their first contribution in google/go-containerregistry#2441

**Full Changelog**: https://github.com/google/go-containerregistry/compare/v0.22.0...v0.22.1</pre>
  <p>View the full release notes at <a href="https://github.com/google/go-containerregistry/releases/tag/v0.22.1">https://github.com/google/go-containerregistry/releases/tag/v0.22.1</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!18250
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

crane: v0.22.0 release binaries built with go1.25.0 instead of the declared toolchain go1.26.6

3 participants