-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
65 lines (53 loc) · 1.52 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
GO_FILES ?= ./...
GO = GO111MODULE=on go
install:
@echo "[+] install"
$(GO) get -v -t $(GO_FILES)
.PHONY: install
test:
@echo "[+] test"
$(GO) test -cover -v -race $(GO_FILES)
.PHONY: test
coverage:
@echo "[+] test with coverage"
$(GO) test -race -coverprofile=coverage.txt -covermode=atomic $(GO_FILES)
.PHONY: coverage
lint: vet golangci-lint revive sec
.PHONY: lint
revive: scripts/bin/revive
@echo "[+] lint via revive"
@scripts/bin/revive \
-formatter stylish \
-config ./scripts/configs/revive.toml \
-exclude ./vendor/... \
$(GO_FILES)
.PHONY: revive
golangci-lint: scripts/bin/golangci-lint
@echo "[+] lint via golangci-lint"
@scripts/bin/golangci-lint run \
--config ./scripts/configs/.golangci.yml \
$(GO_FILES)
.PHONY: golangci-lint
sec: scripts/bin/gosec
@echo "[+] lint via gosec"
@scripts/bin/gosec -quiet \
-exclude=G104,G107,G108,G201,G202,G204,G301,G304,G307,G401,G402,G501 \
-conf=./scripts/configs/gosec.json \
$(GO_FILES)
.PHONY: sec
vet:
@echo "[+] lint via go vet"
@$(GO) vet $(GO_FILES)
.PHONY: vet
scripts/bin/watcher: scripts/go.mod
@cd scripts; \
$(GO) build -o ./bin/watcher github.com/canthefason/go-watcher/cmd/watcher
scripts/bin/revive: scripts/go.mod
@cd scripts; \
$(GO) build -o ./bin/revive github.com/mgechev/revive
scripts/bin/golangci-lint: scripts/go.mod
@cd scripts; \
$(GO) build -o ./bin/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint
scripts/bin/gosec: scripts/go.mod
@cd scripts; \
$(GO) build -o ./bin/gosec github.com/securego/gosec/cmd/gosec