-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
26 lines (20 loc) · 887 Bytes
/
Makefile
File metadata and controls
26 lines (20 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
.PHONY: gen build test codegen-build gen-check ci
gen:
go generate ./...
build:
go build ./...
test:
go test ./...
# Compile the code generators under the `codegen` build tag they actually run
# with. A normal `go build ./...` never sets this tag, so a generator that no
# longer compiles (e.g. it references a renamed or removed type) would otherwise
# go unnoticed until someone runs `go generate`.
codegen-build:
go build -tags codegen $(shell go list ./... | grep '/gen$$')
# Regenerate everything and fail if the committed output changed, catching both
# generators that no longer compile and generated files that are out of date.
gen-check: gen
@git diff --exit-code -- '*_gen.go' '*_gen.*.go' || \
{ echo "generated files are out of date; run 'make gen' and commit the result" >&2; exit 1; }
# Aggregate target suitable for CI.
ci: build codegen-build gen-check test