Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: build install clean test test-integration test-all lint fmt generate setup help
.PHONY: build install clean test test-integration test-all lint fmt generate check setup help

VERSION ?= dev
LDFLAGS := -ldflags "-X main.version=$(VERSION)"
Expand Down Expand Up @@ -72,4 +72,15 @@ fmt: ## Format code
generate: ## Generate code (API client, etc.)
./scripts/generate.sh

check: ## Verify generated code is up to date (fails if `make generate` would produce a diff)
@echo "Checking for local changes in generated files..."
@[ -z "$$(git status --porcelain -- internal/api/client.gen.go internal/api/property_names.gen.go 'internal/cmd/*_flags.gen.go')" ] || \
(echo "Error: generated files have uncommitted local changes (including staged or untracked). Commit or stash them before running 'make check'." && exit 2)
@echo "Running code generation..."
@./scripts/generate.sh >/dev/null
@echo "Checking for diffs in generated files..."
@[ -z "$$(git status --porcelain -- internal/api/client.gen.go internal/api/property_names.gen.go 'internal/cmd/*_flags.gen.go')" ] || \
(echo "Generated code is out of date. Run 'make generate' and commit the changes." && git status --short -- internal/api/client.gen.go internal/api/property_names.gen.go 'internal/cmd/*_flags.gen.go' && exit 1)
@echo "✓ Generated code is up to date"

.DEFAULT_GOAL := build
Loading