-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.common
55 lines (43 loc) · 1.55 KB
/
Makefile.common
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
GOHOME ?= ${HOME}
GOPATH ?= ${GOHOME}
GOBIN ?= ${GOPATH}/bin
ZZZGO = $(wildcard ../xop*-go/*.zzzgo ../xop*-go/*/*.zzzgo ../xop*-go/*/*/*.zzzgo)
ZZZGENERATED = $(patsubst %.zzzgo, %.go, $(ZZZGO))
PB = xopproto/ingest.pb.go xopproto/ingest_grpc.pb.go
TOOLS = ${GOBIN}/gofumpt ${GOBIN}/goimports ${GOBIN}/enumer
TEST_ONLY ?=
CLONE_DEPTH ?= 1
all: $(ZZZGENERATED) $(PB) .gitattributes
go generate ./...
go build ./...
for i in $(RELATED); do (echo $$i ...; cd ../$$i && go generate ./... && go build ./...); done
.gitattributes: $(ZZZGENERATED)
echo '*.zzzgo linguist-language=Go' > $@
echo 'doc.go linguist-documentation' >> $@
echo '*.md linguist-documentation' >> $@
echo '*.pb.go linguist-generated' >> $@
for i in $(ZZZGENERATED); do echo "$$i linguist-generated" >> $@; done
${GOBIN}/gofumpt:;
go install mvdan.cc/gofumpt@latest
${GOBIN}/goimports:;
go install golang.org/x/tools/cmd/goimports@latest
${GOBIN}/enumer:;
go install github.com/dmarkham/enumer@latest
%.go : %.zzzgo tools/xopzzz/xopzzz.go $(TOOLS) Makefile
go run tools/xopzzz/xopzzz.go < $< > [email protected]
-chmod +w $@
gofumpt -w [email protected]
goimports -w [email protected]
-mv [email protected] $@
-chmod -w $@
coverage: calculate_coverage
go tool cover -html=coverage.txt
golanglint:
# binary will be $(go env GOPATH)/bin/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.52.2
golangci-lint --version
lint:;
golangci-lint run
misspell:;
go install github.com/client9/misspell/cmd/misspell@latest
misspell -w `find . -name \*.md`