Debian Codegraph @

Makefile

raw
1 .PHONY: test
2
3 GO ?= go
4 GOFMT ?= gofmt "-s"
5 PACKAGES ?= $(shell $(GO) list ./...)
6 GOFILES := $(shell find . -name "*.go" -type f)
7
8 install-embedmd:
9 @hash embedmd > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
10 $(GO) get -u github.com/campoy/embedmd; \
11 fi
12
13 embedmd-check: install-embedmd
14 embedmd -d *.md
15
16 embedmd: install-embedmd
17 embedmd -w *.md
18
19 .PHONY: fmt
20 fmt:
21 $(GOFMT) -w $(GOFILES)
22
23 .PHONY: fmt-check
24 fmt-check:
25 @diff=$$($(GOFMT) -d $(GOFILES)); \
26 if [ -n "$$diff" ]; then \
27 echo "Please run 'make fmt' and commit the result:"; \
28 echo "$${diff}"; \
29 exit 1; \
30 fi;
31
32 test: fmt-check
33 @$(GO) test -v -cover -coverprofile coverage.txt ./... && echo "\n==>\033[32m Ok\033[m\n" || exit 1
34
35 vet:
36 $(GO) vet ./...
37
38 lint:
39 @hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
40 $(GO) get -u github.com/mgechev/revive; \
41 fi
42 revive -config .revive.toml ./... || exit 1
43
44 .PHONY: misspell-check
45 misspell-check:
46 @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
47 $(GO) get -u github.com/client9/misspell/cmd/misspell; \
48 fi
49 misspell -error ./...
50
51 .PHONY: misspell
52 misspell:
53 @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
54 $(GO) get -u github.com/client9/misspell/cmd/misspell; \
55 fi
56 misspell -w $(GOFILES)
57
58 clean:
59 $(GO) clean -modcache -cache -i
60 find . -name "coverage.txt" -delete