From c860808528e45751f059a4b1122a4fbeea99849b Mon Sep 17 00:00:00 2001 From: kami Date: Fri, 31 Jul 2026 10:10:27 +0400 Subject: [PATCH] Make make test actually gate on gofmt and vet DESIGN.md has always said `make test` is "gofmt + vet + -race, no exceptions". It only ever ran the tests, which is how nine files drifted out of format without anyone noticing. `test` now depends on `fmt-check` and `vet`. Checked that fmt-check does fail when a file is unformatted, so the gate is real and not decorative. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01CGeSZxh1DCtRxmFVSYVGvJ --- Makefile | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6c4f8e6..c4d2395 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ PIPER_BIN := $(shell pwd)/deps/piper/piper PIPER_MODEL := $(shell pwd)/models/tts/ru_RU-irina-medium.onnx PIPER_ESPEAK := $(shell pwd)/deps/piper/espeak-ng-data -.PHONY: all build build-stt build-tts build-daemon build-client build-waked build-web build-poll build-caldav clean test run-stt run-tts run-web download-embedder deps-go eval-router eval-recall +.PHONY: all build build-stt build-tts build-daemon build-client build-waked build-web build-poll build-caldav clean test fmt-check vet run-stt run-tts run-web download-embedder deps-go eval-router eval-recall all: build @@ -69,7 +69,20 @@ deps-go: done $(GO) version -test: +# fmt-check fails if any file needs gofmt. DESIGN.md has always said `make +# test` gates on gofmt and vet; it did not, so nine files quietly drifted. +# Run `gofmt -w` on whatever this prints. +fmt-check: + @bad=$$(gofmt -l internal cmd); \ + if [ -n "$$bad" ]; then \ + echo "these files need gofmt:"; echo "$$bad"; exit 1; \ + fi + +vet: + CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" LD_LIBRARY_PATH="$(shell pwd)/deps/lib" \ + $(GO) vet ./internal/... ./cmd/... + +test: fmt-check vet CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" LD_LIBRARY_PATH="$(shell pwd)/deps/lib" \ $(GO) test -race -coverprofile=coverage.out ./internal/... ./cmd/...