← Back to issue list

snap build fails if go must download the version

View original Github issue

Metadata

Project
craft-parts
Number
#1447
Type
issue
State
open
Author
adombeck
Labels
Created
Updated
Closed

Current evaluation

Go plugin env validation in craft-parts fails when `go version` triggers a toolchain auto-download, because validator._execute returns stderr ('go: downloading go1.25.6...') instead of stdout. Bug confirmed present in current code; a contributor requested assignment 8 days ago.

Suggested action: keep open

Reason: The bug is confirmed still present: validator.py's _execute() (line ~152) returns `proc.stderr if proc.stderr else proc.stdout`, so when Go auto-downloads a toolchain the 'go: downloading...' stderr line is misread as the version and GoPluginEnvironmentValidator raises 'invalid go compiler version'. A contributor (gcomneno) requested assignment 8 days ago, indicating active interest. The fix is small (use stdout for the version check, or tolerate the download message), but no maintainer has yet triaged or labelled it.

Impact: 55 Quick Win: 41.25 Staleness: 15 Complexity: 25 Confidence: 80 Support Request: 5

Issue body

### Bug Description I see `snapcraft pack` fail with: ``` Environment validation failed for part 'semver': invalid go compiler version 'go: downloading go1.25.6 (linux/amd64)'. Failed to run snapcraft in instance ``` It works when I execute `snapcraft pack` again. I assume that's because the required Go version was then already downloaded on the instance. I took a quick look at the code where this error originates from. [This](https://github.com/canonical/craft-parts//blob/71291d50ec95aed813215e89463866dd09aaaa5e/craft_parts/plugins/go_plugin.py#L66-L71) is the call to `go version` which calls `subprocess.run` and [returns the stderr](https://github.com/canonical/craft-parts//blob/71291d50ec95aed813215e89463866dd09aaaa5e/craft_parts/plugins/validator.py#L145-L152) it it's non-empty, which it then assumes is the go version. It should use the output on stdout instead. ### To Reproduce I encounter this when trying to build the authd snaps: ```bash git clone https://github.com/canonical/authd cd authd # Prepare snapcraft.yaml ./scripts/prepare-broker-variant-files # Build the snap snapcraft pack ``` ### part yaml ```yaml semver: source: authd-oidc-brokers/tools source-type: local plugin: go override-build: | go mod download all go mod vendor go build -o ${GOBIN}/semver semver/semver.go ``` ### Relevant log output I assume the above is enough to understand the issue. Let me know if you do need logs.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 55
Quick Win: 41.25
Staleness: 15
Complexity: 25
Confidence: 80
Support Request: 5
keep open Go plugin env validation in craft-parts fails when `go version` triggers a toolchain auto-download, because validator._execute returns stderr ('go: downloading go1.25.6...') instead of stdout. Bug confirmed present in current code; a contributor requested assignment 8 days ago.
qwen/qwen3.8-27b
Impact: 45
Quick Win: 29.25
Staleness: 20
Complexity: 35
Confidence: 85
Support Request: 5
needs triage Go plugin environment validation fails on first build when go auto-downloads a toolchain, because validator._execute returns stderr ('go: downloading go1.25.6...') instead of stdout. Bug confirmed still present in current code; contributor volunteered 8 days ago, no labels or maintainer response yet.
qwen/qwen3.8-27b
Impact: 45
Quick Win: 29.25
Staleness: 25
Complexity: 35
Confidence: 85
Support Request: 5
needs triage snapcraft pack fails on first run of a go part when go auto-downloads a toolchain: the validator reads stderr of `go version` and misreads the 'go: downloading...' message as the version. Bug still present in craft-parts; a contributor asked to be assigned 8 days ago.
qwen/qwen3.6-35b-a3b
Staleness: 70
Complexity: 10
Confidence: 90
Support Request: 0
needs triage Go plugin incorrectly reads stderr instead of stdout when checking Go version, causing snapcraft pack to fail during version downloads. Untriaged and awaiting maintainer review.
qwen3.6-35b-a3b-mtp-q6
Staleness: 45
Complexity: 15
Confidence: 85
Support Request: 0
needs triage Bug in craft-parts Go plugin where go version reads stderr instead of stdout, causing failures when Go needs to download a version. A contributor recently volunteered to fix it.
qwen3.6-35b-a3b-mtp-q6
Staleness: 65
Complexity: 20
Confidence: 90
Support Request: 10
needs triage snapcraft pack fails when the Go plugin downloads a missing version because the validator reads stderr instead of stdout for the version string. Open and awaiting assignment after a contributor requested to fix it.

Update history

Date Change
updated

Related work

  • Duplicate Of: canonical/rockcraft#902 (confidence 70%)

    Rockcraft issue 902 reports the identical failure: Go plugin environment validation fails when `go version` triggers a toolchain auto-download, printing 'go: downloading...' instead of a version string. Same root cause in the shared craft-parts go_plugin validator.

Related issues

Issue Project State Summary Similarity
#902 Go plugin environment validation fails if toolchain downloads a new version rockcraft open Go plugin environment validation fails when `go version` triggers a Go toolchain auto-download, printing 'go: downloading...' instead of a version string. Open 439 days with no labels or maintainer activity; bug still present in craft-parts go_plugin validator.
84%