Restore config loading, keep exported Version, keep cgo off

Bring back the in-progress viper and go-homedir configuration loading
from the original root command as a persistent pre-run on the root
command, with a --config flag and a config line in sutil info. Restore
the exported main.Version with a nolint directive instead of renaming
it. Export CGO_ENABLED=0 from the Makefile, drop -race from make test,
and remove the C toolchain from the Docker builder stage.
This commit is contained in:
2026-10-31 10:11:47 -07:00
parent f53b6aad42
commit 4d45aa4ca3
9 changed files with 243 additions and 25 deletions
+2 -4
View File
@@ -33,9 +33,7 @@ RUN make fmt-check-md
# Build stage
# golang:1.26-alpine, 2026-10-27
FROM golang@sha256:a2012b4a1d1f9f7e9f44e0d39b805a901e856b1dd80b4e6ee4338db547050308 AS builder
# gcc and musl-dev are needed only because `make test` uses -race, which
# requires cgo; the release binary below is built with CGO_ENABLED=0.
RUN apk add --no-cache make gcc musl-dev
RUN apk add --no-cache make
WORKDIR /src
# Force BuildKit to run the lint and docs stages before proceeding
@@ -49,7 +47,7 @@ RUN make test
ARG VERSION=dev
RUN CGO_ENABLED=0 go build -trimpath \
-ldflags="-s -w -X main.version=${VERSION}" \
-ldflags="-s -w -X main.Version=${VERSION}" \
-o /sutil ./cmd/sutil
# Runtime stage: the binary plus the full source it was built from