-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (52 loc) · 1.53 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
PROJECT := github.com/eurielec/bulkerrs
all: update-mod check-license check-go check-doc check
.PHONY: all
check: check-license check-fmt check-doc
@(echo " -> Go Test")
go test $(PROJECT)/...
.PHONY: update-mod
update-mod:
@(echo " -> Go Mod")
@(cd $(GOPATH)/src/$(PROJECT) && dep ensure -update)
@(go mod vendor -v)
@(go mod tidy -v)
.PHONY: check-license
check-license:
@(echo " -> Go Check License")
@(grep -rl "Licensed under the GPLv3" --include="*.go" --exclude-dir="./vendor" .;\
find ./ -path "./vendor/*" -prune -o -name "*.go" -print) | sed -e 's,\./,,' | sort | uniq -u | \
xargs -I {} echo FAIL: licence missed: {}
.PHONY: check-fmt
check-fmt:
@(echo " -> Go Check Format")
$(eval GOFMT := $(strip $(shell gofmt -l .| grep -v "^vendor/" | sed -e "s/^//g")))
@(if [ "x$(GOFMT)" != "x" ]; then \
echo " detected wrongly formatted files: $(GOFMT)"; \
echo ' please run "make go-fmt"'; \
exit 1; \
fi)
@(go vet -all -composites=false -copylocks=false .)
.PHONY: check-doc
check-doc:
@(echo " -> Go Check Doc")
$(eval GODOC := $(shell gomarkdoc -c . 2>&1))
@(if [ "$(GODOC)" != "" ]; then \
echo " Fail! Did you forget to run gomarkdoc?"; \
echo ' please run "make doc"'; \
exit 1; \
else \
echo " OK!"; \
fi)
.PHONY: go-fmt
go-fmt:
@(echo " -> Go Format")
@(find ./ -path "./vendor/*" -prune -o -name "*.go" -exec gofmt -l -w {} \;) | \
sed -e "s/^./ - fixed: /g"
.PHONY: doc
doc:
@(echo " -> Go Doc")
@(gomarkdoc .)
.PHONY: tag
tag:
@(echo " -> Git make tag")
@(git tag "v$(shell cat VERSION)")