-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
81 lines (61 loc) · 2.2 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
OUTPUT="./output"
SRC=$(shell find . -name "*.go")
.PHONY: all clean ci build build_vanilla build_bsd test check_fmt fmt vet security security_w
.PHONY: lint quality gocyclo goimports
all: clean install_deps quality security test build
# ci*: run tests & build ouput based on runing OS
ci: clean install_deps quality security test build_vanilla
ci_windows: clean install_deps quality security_w test build_vanilla
output:
$(info ***************** Create "output" directory ***********************************)
mkdir $(OUTPUT)
clean:
$(info ***************** Clean ***********************************)
rm -rf $(OUTPUT)
go clean -cache -testcache -modcache
security:
$(info ***************** Security ***********************************)
gosec ./...
@echo "[OK] Go security check is done!"
security_w:
$(info ***************** Security ***********************************)
gosec "./..."
@echo "[OK] Go security check is done!"
lint:
$(info ***************** Lint ***************************************)
revive -set_exit_status ./...
@echo "[OK] Go linting is done!"
gocyclo:
$(info ***************** gocyclo ************************************)
gocyclo -total-short -over 10 .
@echo "[OK] gocyclo is done!"
goimports:
$(info ***************** goimports ***********************************)
goimports -w ./..
@echo "[OK] goimpors is done!"
quality: check_fmt vet lint gocyclo
build: output
make -f build.make all
build_vanilla: output
make -f build.make build_vanilla
build_bsd: output
make -f build.make build_bsd
test: check_fmt vet
$(info ***************** Run tests ***********************************)
go test -v -count=1 ./...
install_deps:
$(info ***************** Install dependancies ***********************************)
go get ./...
@echo "[OK] Go dependancies is get!"
check_fmt:
$(info ***************** Check formatting ***********************************)
test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1)
@echo "[OK] Go code formating"
fmt:
$(info ***************** Do the formatting ***********************************)
gofmt -w $(SRC)
vet:
$(info ***************** Run go vet ***********************************)
go vet ./...
@echo "[OK] Go vet is done!"
# vi:syntax=make