Repository navigation
fix: set GOTOOLCHAIN=local in snapcraft.yaml to prevent auto-download - #2012
Merged
TerryHowe merged 2 commits intoMar 20, 2026
Merged
Conversation
When Go's GOTOOLCHAIN is set to 'auto' (the default), it will attempt to download a newer Go toolchain if go.mod specifies a version higher than the currently installed one. During a snap build, snapcraft's environment validator receives the download progress string (e.g. 'go: downloading go1.x.x (linux/amd64)') as the Go compiler version, which is not a valid version string, causing the build to fail. Setting GOTOOLCHAIN=local ensures the snap's bundled Go toolchain is always used, preventing unexpected downloads during snap builds. Signed-off-by: Terry Howe <[email protected]>
TerryHowe
requested review from
Wwwsylvia,
sabre1041,
sajayantony and
shizhMSFT
as code owners
March 20, 2026 12:59
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2012 +/- ##
=======================================
Coverage 87.18% 87.18%
=======================================
Files 143 143
Lines 5539 5539
=======================================
Hits 4829 4829
Misses 423 423
Partials 287 287 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sajayantony
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When building the snap package, if the Go toolchain installed via the build snap is older than the version specified in
go.mod, Go's defaultGOTOOLCHAIN=autobehavior causes it to attempt downloading a newer toolchain. Snapcraft's environment validator then receives the download progress message (e.g.go: downloading go1.x.x (linux/amd64)) as the Go compiler version string — which is invalid — causing the snap build to fail.This was observed in the
release-1.3snap CI job: https://github.com/oras-project/oras/actions/runs/23341326576/job/67895417718Fix
Add
GOTOOLCHAIN: "local"to thebuild-environmentinsnapcraft.yaml. This ensures the snap's bundled Go toolchain is always used, preventing unexpected downloads during snap builds. Thego/1.25/stablesnap channel tracks the latest Go 1.25 patch releases and is compatible with thego 1.25.7requirement ingo.mod.