-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
33 lines (24 loc) · 888 Bytes
/
Makefile
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
27
28
29
30
31
32
33
GOPATH := $(PWD)/.cache
PATH := $(PATH):$(GOPATH)/bin
SHELL := env PATH=$(PATH) /bin/bash
PROTOC_GEN_GO := $(GOPATH)/bin/protoc-gen-go
PROTO := validate/validate.proto
GENPROTO_GO := $(PROTO:.proto=.pb.go)
.PHONY: all
all: go-genproto
$(PROTOC_GEN_GO):
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
%.pb.go: %.proto
protoc --go_out=. --go_opt=paths=source_relative $<
.PHONY: go-genproto
go-genproto: $(PROTOC_GEN_GO) $(GENPROTO_GO)
test:
go test -count=1 ./cmd/... ./validate/...
.PHONY: testdata
testdata:
find testdata/ -name '*.proto' -exec protoc --go_out=. --go_opt=paths=source_relative {} \;
find testdata/ -name '*.pb.go' -exec sed -i "/github.com\/nlachfr\/protoc-gen-cel-validate\/validate/d" {} \;
coverage:
go test -count=1 ./cmd/... ./validate/... -cover -coverprofile=.cover.tmp
grep -v .pb.go .cover.tmp > .cover
go tool cover -func .cover