Files
uberbringer/Makefile
T
57_WolveandClaude Opus 5.5 2926a69598 Check that libc stays at the version the SQLite driver requires
modernc.org/sqlite is C transpiled to Go against one version of
modernc.org/libc, and its go.mod names that version exactly: v1.80.1
for v1.64.0, while libc's latest is v1.82.14. A newer libc breaks the
driver without a compile error, and a routine go get -u would move it.
The owner accepted holding libc there as the one exception to taking
each dependency at its latest stable release; it moves only with the
driver.

tools/libcpin compares the libc that go list -m selects with the one
go mod graph shows the selected modernc.org/sqlite requiring, and fails
with the go get that restores it. It runs as go run ./tools/libcpin,
so it works from PowerShell and in CI alike. test.yml and make check
run it after go mod tidy -diff, CLAUDE.md lists it in the gate and
records the exception beside the dependency rule, and design.md records
it under the stack choices.

Moving libc to v1.82.14 with go get made the check fail as it should;
the change was not kept.

Part of stage 1d of docs/plans/job-store.md (decision 13).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 16:37:45 -06:00

80 lines
2.6 KiB
Makefile

.PHONY: build build-arm test lint fmt fmt-check vet tidy tidy-check libc-check vuln generate generate-check release-check snapshot check run
# Without the leading v, as goreleaser's {{ .Version }} reports it.
VERSION ?= $(patsubst v%,%,$(shell git describe --tags --always --dirty 2>/dev/null || echo dev))
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
LDFLAGS := -s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT)
# The files go generate writes.
GENERATED := docs/swagger.json THIRD-PARTY-LICENSES.md internal/app/uberbringer/licenses_embed.md
build:
go build -trimpath -ldflags "$(LDFLAGS)" -o bin/ ./cmd/...
# Cross-compiles the daemon for 32-bit (ARMv6) and 64-bit ARM without cgo,
# as releases are built, and discards the binaries.
build-arm:
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o /dev/null ./cmd/uberbringer
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o /dev/null ./cmd/uberbringer
# The limit is per package: a hung test fails with every goroutine's stack.
test:
go test -race -timeout 5m ./...
lint:
go tool staticcheck ./...
# gofmt and goimports take paths, not ./... package patterns.
fmt:
gofmt -w .
go tool goimports -w .
fmt-check:
@test -z "$$(gofmt -l .)" || (echo "gofmt needed:"; gofmt -l .; exit 1)
@test -z "$$(go tool goimports -l .)" || (echo "goimports needed:"; go tool goimports -l .; exit 1)
vet:
go vet ./...
tidy:
go mod tidy
# Prints the change and fails, without writing, if go.mod or go.sum is not tidy.
tidy-check:
go mod tidy -diff
# Fails unless modernc.org/libc is the exact version modernc.org/sqlite
# requires, which the driver needs.
libc-check:
go run ./tools/libcpin
vuln:
go tool govulncheck ./...
# Runs every go:generate directive, which writes docs/swagger.json,
# THIRD-PARTY-LICENSES.md and the copy of it that the binary embeds.
generate:
go generate ./...
# Fails when a generated file differs from what the route table and the
# linked modules produce.
generate-check: generate
git diff --exit-code -- $(GENERATED)
# Validates .goreleaser.yaml without building anything.
release-check:
goreleaser check
# Cross-compiles every shipped target and packs the release archives into
# dist/, publishing nothing. Run it after changing .goreleaser.yaml or
# packaging/; CI builds release binaries only for tags.
snapshot:
goreleaser release --snapshot --clean
# The gate .gitea/workflows/test.yml runs, in the same order.
# .gitea/workflows/security.yml runs vuln.
check: fmt-check tidy-check libc-check vet lint generate-check test build-arm release-check
run:
go run ./cmd/uberbringer --config config.toml