Skip to content

refactor(features): port golang.sh to luggage (binary-tarball) - #1347

Merged
joshjhall merged 1 commit into
mainfrom
feature/issue-811
Oct 21, 2026
Merged

joshjhall merged 1 commit into
mainfrom
feature/issue-811

Conversation

@joshjhall

Copy link
Copy Markdown
Owner

Summary

PR C of 3 for #811 — the port itself. lib/features/golang.sh no longer downloads, verifies, or extracts Go; it runs luggage install go@${GO_VERSION} against the vendored catalog.

  • Prerequisites already merged: feat(luggage): add {arch} URL placeholder and catalog-declared version_args #1345 (luggage {arch} URL placeholder + catalog-declared Tool.version_args, needed because go --version exits 2) and feat(tools): add go catalog entry with binary-tarball install method containers-db#456 (the go catalog: 70 stable versions 1.22.0–1.27.3, one binary-tarball method each, tier-3 against dl.google.com's .sha256).
  • Vendored catalog: crates/luggage/testdata/catalog/tools/go/ is a byte-identical mirror of containers-db 67f04700; just db-validate-vendored compares all 71 go entries, 0 drift.
  • golang.sh: removed arch detection, curl, the 4-tier verify_download_or_fail flow, tar -xzf, the symlink loop, and four sourced helpers. Partial versions (1.26) resolve via luggage resolve go, read with an anchored sed (no jq — no base image installs it) and surfacing luggage's own stderr on failure. git stays an apt_install (runtime need of go get).
  • Behavior changes, by design:
    • Go < 1.22 is refused up front with a clear message (the catalog floor), replacing a "continuing with installation" warning that could no longer succeed.
    • amd64/arm64 only, matching docs/reference/supported-platforms.md. The old armhf (armv6l) / i386 (386) arms covered platforms this project never built; luggage refuses them by name (no install method for go@X matches debian/armhf).
  • Version updater: the Go arm now runs update_luggage_catalog "go" so auto-patch keeps the vendored catalog in lockstep with the pin.

Also in this PR (disclosed scope)

  • Prerequisite — Rust MSRV in integration fixtures. Both luggage fixtures were on rust:1.98.0; the workspace MSRV is 1.99, so cargo build refused. The existing rust fixture was silently broken (weekly tier, unnoticed); the new go fixture can't build without the fix. tests/unit/rust-version-sync.sh now checks fixture builder images too (including --platform= / registry-prefixed spellings), so the next MSRV bump names them.
  • Incidental — memory. Two lessons learned on this issue, folded into existing entries (no index growth): omitting diff for a cross-repo review reviews the cwd branch instead; and two new "test passes/fails for the wrong reason" cases (a fixture with no real decoy; a $(...) || rc=$? harness that disables set -e in the code under test).

Test plan

  • just test-integration-one luggage_golang — 2/2 PASS on a real build: go1.27.2 linux/arm64; go/gofmt → /usr/local/go/bin; GOROOT=/usr/local/go; /cache/go, /cache/go-build, /cache/go-mod all owned by vscode; luggage log shows verify (tier 3); GO_VERSION=1.26 resolves to 1.26.10. Fixture installs no jq and passes golang.sh's real install flags.
  • just test-integration-one luggage_rust — 1/1 PASS (confirms the MSRV fix).
  • Unit, golang suite 22/22 — runs golang.sh's real version and install blocks against a stub luggage: partial resolve (with a nested-"version" decoy), exact pin skips luggage, failed resolve surfaces luggage's error, no-version fails closed, <1.22 refused, bare "1" rejected by validation, 2.0 reaches resolve, a failing install aborts the script, exact install argv.
  • Every new test is mutation-killed on a scratch copy (loosened sed anchor, swallowed stderr, dropped empty-check, floor as warning, || true / || : / || echo, dropped --user / --cache-root, wrong catalog, Go updater "rust" / $current, respelled stale builder).
  • cargo test --workspace, just test (0 failures), just db-validate-vendored (0 drift), shellcheck clean.
  • Adversarial pre-PR review (ship-issue workflow.js harness): 5 cycles; cycle 1's five blocking findings fixed; final full-scope cycle clean, its in-scope test gaps fixed in this commit.

Follow-ups

Closes #811

🤖 Generated with Claude Code

golang.sh no longer downloads, verifies, or extracts Go itself. It
delegates to `luggage install go@${GO_VERSION}` against the vendored
containers-db catalog, which now carries go (1.22.0..1.27.3, mirrored
verbatim from containers-db 67f04700). Partial versions ("1.26") resolve
via `luggage resolve go` to the newest catalog patch, as rust.sh does.

Partials are read from luggage's JSON with an anchored sed, not jq (no
base image installs jq), and a failed resolve surfaces luggage's own
stderr. Go < 1.22 is refused up front (the catalog floor). Scope is
amd64/arm64, matching docs/reference/supported-platforms.md: the old
armhf/i386 arms covered platforms this project never built.

luggage picks the per-arch artifact via the {arch} URL placeholder,
verifies it at tier 3 against dl.google.com's published .sha256,
extracts under /usr/local, creates + chowns GOPATH/GOCACHE/GOMODCACHE
from the catalog's cache_dirs, links go/gofmt into /usr/local/bin, and
validates with `go version` (the catalog's version_args; `go --version`
exits 2). Removed from bash: arch detection, curl, the 4-tier
verify_download_or_fail flow, tar -xzf, the symlink loop, and the
version-resolution/download-verify/checksum-fetch/checksum-verification
sources. `git` stays an apt_install: a runtime need of `go get`, not an
install dependency.

Also:
- tests/integration/builds/test_luggage_golang.sh + fixture: exact-pin
  and partial (1.26 -> newest vendored 1.26.x) builds.
- Both luggage integration fixtures now build on rust:1.99 (the MSRV).
  They were on rust:1.98.0 and failed `cargo build` on rust-version
  since the MSRV moved — the existing rust fixture was silently broken.
  tests/unit/rust-version-sync.sh now checks fixture builder images too.
- updaters.sh Go arm keeps the vendored catalog in lockstep with the pin,
  with a propagation test twin of the Rust arm's.
- golang unit tests run the real version block against a stub luggage
  (partial/exact/failure/no-version/pre-floor), each mutation-killed.
- Memory (incidental, learned on this issue): harness-placeholder-args-
  fake-review warns that omitting `diff` for a cross-repo PR reviews the
  cwd branch; assertions-must-discriminate gains the missing-decoy case.

Closes #811

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joshjhall
joshjhall merged commit c99fc4c into main Oct 21, 2026
21 checks passed
@joshjhall
joshjhall deleted the feature/issue-811 branch October 21, 2026 20:59
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.

refactor(features): port golang.sh to luggage (binary-tarball)

1 participant