Etapa G frente Go: vendoring integrado en fetch — amfora construye, repro

Cierra el muro del frente Go (vendoring) replicando el patron de Rust:
vendorear in-situ en el fetch (host, con red), no tarball-al-mirror.

- fetch.rs: vendor_go_deps() analoga a vendor_cargo_deps — corre go mod vendor
  en el host si hay go.mod; el sandbox compila offline con -mod=vendor.
- lib.rs: engancha vendor_go_deps tras los patches cuando el arbol trae go.mod
  (sin BuildSys::Go; el compile lo fija la receta en build.phases).
- bootstrap-devfs.sh: instala el toolchain go del host (1.26.4, estatico) en
  .dev-fs/tools/go + symlink en ~/.cargo/bin (PATH del worker via .cargo/env).
- amfora: PRIMERA receta Go del corpus. Build end-to-end validado (repo+commit
  -> fetch vendorea -> sandbox offline -> binario estatico que corre, Amfora
  v1.11.0). REPRODUCIBLE bit-a-bit: dos stores independientes dan of_tree
  b3:9ec1d5fe (trimpath + buildid= en el compile). Promovida al repo (282).

Quedan 12 recetas Go en tandas/staged-2026-06-26/ (cheat/dnsx/croc/dyff/csvtk/
git-town/miller/jump/gron/qrcp/walk/gtrash): mecanico, copiar el patron de
amfora ajustando el nombre del binario.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-26 04:34:56 -04:00
co-authored by Claude Opus 4.8
parent 1670ebf933
commit 4291b2adeb
5 changed files with 120 additions and 10 deletions
+33
View File
@@ -28,6 +28,9 @@ ALPINE_VER="${ALPINE_VER:-3.23.4}"
ALPINE_SHA256="${ALPINE_SHA256:-85498865362aa7ebececa0d725a2f2e4db7ac4e4b2850b8df21645afa0d03ee3}"
ZIG_VER="${ZIG_VER:-0.16.0}"
ZIG_SHA256="${ZIG_SHA256:-70e49664a74374b48b51e6f3fdfbf437f6395d42509050588bd49abe52ba3d00}"
# Toolchain Go del HOST (para `go mod vendor` en el fetch; cf. recipes/go.toml para el sandbox).
GO_VER="${GO_VER:-1.26.4}"
GO_SHA256="${GO_SHA256:-1153d3d50e0ac764b447adfe05c2bcf08e889d42a02e0fe0259bd47f6733ad7f}"
SKIP_APK=0
FORCE_ZIG=0
@@ -100,6 +103,36 @@ else
ok "zig $ZIG_VER instalado, symlink $ZIG_LINK"
fi
# --- 2b. Toolchain Go del host (frente Go, Etapa G) ----------------------------
# El vendoring de módulos Go (`go mod vendor`) corre en el HOST durante el fetch (red
# permitida), igual que `cargo vendor`. El binario `go` oficial es estático ⇒ corre en
# cualquier host. Lo dejamos en .dev-fs/tools/go (fuente de verdad versionada) y lo
# enlazamos a ~/.cargo/bin (que el worker pone en PATH vía `. ~/.cargo/env`).
GO_DIR="$TOOLS/go-$GO_VER"
GO_LINK="$TOOLS/go"
if [[ -x "$GO_LINK/bin/go" ]] && "$GO_LINK/bin/go" version 2>/dev/null | grep -q "go$GO_VER"; then
ok "go $GO_VER ya presente en $GO_LINK"
else
log "go: descargando $GO_VER"
tar="$TOOLS/go.tar.gz"
url="https://go.dev/dl/go$GO_VER.linux-amd64.tar.gz"
curl -fsSL "$url" -o "$tar"
echo "$GO_SHA256 $tar" | sha256sum -c -
rm -rf "$GO_DIR"; mkdir -p "$GO_DIR"
tar -xzf "$tar" -C "$GO_DIR" --strip-components=1
rm -f "$tar"
ln -sfn "go-$GO_VER" "$GO_LINK"
ok "go $GO_VER instalado en $GO_LINK"
fi
# Symlink en un dir del PATH del host (junto a cargo) para que el fetch encuentre `go`.
if [[ -d "$HOME/.cargo/bin" ]]; then
ln -sfn "$GO_LINK/bin/go" "$HOME/.cargo/bin/go"
ln -sfn "$GO_LINK/bin/gofmt" "$HOME/.cargo/bin/gofmt"
ok "go enlazado en ~/.cargo/bin (PATH del host/worker)"
else
log "go: ~/.cargo/bin no existe; agregá $GO_LINK/bin al PATH del host a mano"
fi
# --- 3. Build tools en el rootfs (apk add) ------------------------------------
if [[ $SKIP_APK -eq 1 ]]; then
log "apk: --skip-apk ⇒ saltando build tools"