refactor: split check into check-fmt, lint, test targets

make check now depends on check-fmt, lint, and test as prerequisites,
each runnable independently.
This commit is contained in:
user 2026-02-20 03:17:38 -08:00
parent 4f7459d509
commit ae0e96eba3

View File

@ -13,7 +13,7 @@ GOLDFLAGS += -X main.Version=$(VERSION)
GOLDFLAGS += -X main.Gitrev=$(GITREV_BUILD) GOLDFLAGS += -X main.Gitrev=$(GITREV_BUILD)
GOFLAGS := -ldflags "$(GOLDFLAGS)" GOFLAGS := -ldflags "$(GOLDFLAGS)"
.PHONY: docker default run ci test fixme .PHONY: docker default run ci test fixme check check-fmt lint
default: fmt test default: fmt test
@ -51,9 +51,8 @@ fmt: mfer/mf.pb.go
-prettier -w *.json -prettier -w *.json
-prettier -w *.md -prettier -w *.md
lint: lint: mfer/mf.pb.go
golangci-lint run golangci-lint run ./...
sh -c 'test -z "$$(gofmt -l .)"'
docker: sneak-mfer.$(ARCH).tzst.dockerimage docker: sneak-mfer.$(ARCH).tzst.dockerimage
@ -80,11 +79,10 @@ modcache.tzst: go.mod go.sum
cd $(shell go env GOMODCACHE) && tar -c . | pv | zstdmt -19 > $(PWD)/$@.tmp cd $(shell go env GOMODCACHE) && tar -c . | pv | zstdmt -19 > $(PWD)/$@.tmp
mv $@.tmp $@ mv $@.tmp $@
# Run all checks (formatting, linting, tests) without modifying files # Individual check targets
check: check-fmt:
@echo "==> Checking formatting..." @echo "==> Checking formatting..."
@test -z "$$(gofmt -l .)" || (echo "Files not formatted:" && gofmt -l . && exit 1) @test -z "$$(gofmt -l .)" || (echo "Files not formatted:" && gofmt -l . && exit 1)
@echo "==> Running linter..."
golangci-lint run ./... # Run all checks (formatting, linting, tests) without modifying files
@echo "==> Running tests..." check: check-fmt lint test
go test -race -timeout 30s ./...