Install pinned goimports in script/bootstrap #196

Merged
clawbot merged 1 commits from fix/bootstrap-goimports into next 2026-09-22 11:11:16 +02:00
Collaborator

Fixes #184.

script/fmt runs gofmt, goimports, and npx prettier, but
script/bootstrap installed only git, make, go, and golangci-lint, so
make fmt failed with goimports: not found on a fresh machine —
bootstrap is contracted to install all dependencies idempotently.

Change

ensure_goimports skips when goimports is already on PATH, otherwise
go installs golang.org/x/tools/cmd/goimports at a pinned version and
installs the binary into /usr/local/bin so it is reachable regardless
of shell config — the landing spot the golangci-lint release install
already uses (go install's default GOPATH/bin is not on a fresh
machine's PATH).

Pinned v0.49.0 (2026-08-13), integrity via the Go module checksum
database. v0.49.0 requires Go 1.25, matching go.mod /
golang:1.25-alpine; v0.50.0 needs Go 1.26 and would force a toolchain
download.

Node/prettier — deliberately out of scope

make fmt also calls npx prettier, itself unpinned (a hash-pinning
violation) and needing node. Guarding it properly means pinned nvm node
plus a hash-locked prettier and dropping npx — a larger change for its
own issue. make fmt-check / make check runs only gofmt, so main
stays green regardless; goimports is the stated blocker.

Verification

Fresh golang:1.25 container without goimports: make bootstrap
installs goimports v0.49.0 to /usr/local/bin (no toolchain download);
with node present, make bootstrap then make fmt exits 0. Docker gate
(docker build .) green.

Model: opus-4-8

Fixes https://git.eeqj.de/sneak/upaas/issues/184. `script/fmt` runs `gofmt`, `goimports`, and `npx prettier`, but `script/bootstrap` installed only git, make, go, and golangci-lint, so `make fmt` failed with `goimports: not found` on a fresh machine — bootstrap is contracted to install all dependencies idempotently. ## Change `ensure_goimports` skips when `goimports` is already on PATH, otherwise `go install`s `golang.org/x/tools/cmd/goimports` at a pinned version and installs the binary into `/usr/local/bin` so it is reachable regardless of shell config — the landing spot the golangci-lint release install already uses (`go install`'s default `GOPATH/bin` is not on a fresh machine's PATH). Pinned `v0.49.0` (2026-08-13), integrity via the Go module checksum database. `v0.49.0` requires Go 1.25, matching `go.mod` / `golang:1.25-alpine`; `v0.50.0` needs Go 1.26 and would force a toolchain download. ## Node/prettier — deliberately out of scope `make fmt` also calls `npx prettier`, itself unpinned (a hash-pinning violation) and needing node. Guarding it properly means pinned nvm node plus a hash-locked prettier and dropping `npx` — a larger change for its own issue. `make fmt-check` / `make check` runs only `gofmt`, so `main` stays green regardless; goimports is the stated blocker. ## Verification Fresh `golang:1.25` container without goimports: `make bootstrap` installs goimports v0.49.0 to `/usr/local/bin` (no toolchain download); with node present, `make bootstrap` then `make fmt` exits 0. Docker gate (`docker build .`) green. Model: opus-4-8
clawbot added the needs-review label 2026-09-22 09:59:54 +02:00
clawbot self-assigned this 2026-09-22 09:59:54 +02:00
clawbot force-pushed fix/bootstrap-goimports from ba9e7198c7 to 8fb3f0c9b5 2026-09-22 10:12:09 +02:00 Compare
Author
Collaborator

Rebased onto current next; resolved the TODO.md conflict (kept both Completed Steps entries). make check green.

Model: opus-4-8

Rebased onto current `next`; resolved the `TODO.md` conflict (kept both Completed Steps entries). make check green. Model: opus-4-8
clawbot added 1 commit 2026-09-22 11:09:40 +02:00
script/fmt runs gofmt, goimports, and npx prettier, but bootstrap
installed only git, make, go, and golangci-lint, so `make fmt` failed
with `goimports: not found` on a fresh machine. bootstrap's contract is
to install all dependencies idempotently.

Add ensure_goimports: it skips when goimports is already on PATH,
otherwise `go install`s golang.org/x/tools/cmd/goimports at a pinned
exact version (v0.49.0; integrity via the Go module checksum database)
and places the binary in /usr/local/bin so it is on PATH regardless of
shell config, mirroring the golangci-lint release install. v0.49.0
requires Go 1.25, matching go.mod; v0.50.0 would force a Go 1.26
toolchain download.

Model: opus-4-8
clawbot force-pushed fix/bootstrap-goimports from 8fb3f0c9b5 to 8f88094307 2026-09-22 11:09:40 +02:00 Compare
Author
Collaborator

PASS. Rebased onto current next (TODO.md changelog conflict only, both entries kept) and gated the rebased tree: the pinned Docker build and make check are green, and on a fresh golang:1.25 container lacking goimports the bootstrap change installs goimports v0.49.0 to /usr/local/bin with no forced toolchain download, idempotently, satisfying the definition of done; leaving node/prettier for a separate hash-pinning issue is reasonable and stated, since fmt-check runs only gofmt.

Model: opus-4-8

PASS. Rebased onto current `next` (`TODO.md` changelog conflict only, both entries kept) and gated the rebased tree: the pinned Docker build and `make check` are green, and on a fresh `golang:1.25` container lacking `goimports` the bootstrap change installs `goimports` v0.49.0 to `/usr/local/bin` with no forced toolchain download, idempotently, satisfying the definition of done; leaving node/prettier for a separate hash-pinning issue is reasonable and stated, since `fmt-check` runs only `gofmt`. Model: opus-4-8
clawbot merged commit 727bd50935 into next 2026-09-22 11:11:16 +02:00
clawbot deleted branch fix/bootstrap-goimports 2026-09-22 11:11:16 +02:00
Sign in to join this conversation.