-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (46 loc) · 1.13 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
aws-deploy:
make build
serverless deploy --verbose
aws-redeploy:
serverless remove
make aws-deploy
# docker run --rm -it amazon/aws-cli command
PROJECT_BIN ?= $(shell pwd)/bin
.PHONY: precommit
precommit: modtidy modupdate gofumpt lint test govuln
.PHONY: modtidy
modtidy:
go mod tidy
.PHONY: modupdate
modupdate:
go get -u ./...
.PHONY: gofumpt
gofumpt: install-gofumpt
$(GOFUMPT_BIN) -l -w -extra .
.PHONY: lint
lint: install-lint
$(LINT_BIN) run -v
.PHONY: test
test:
go test -v ./...
.PHONY: govuln
govuln: install-govuln
$(GOVULN_BIN) ./...
GOFUMPT_BIN = $(PROJECT_BIN)/gofumpt
.PHONY: install-gofumpt
install-gofumpt:
$(call go-install,$(GOFUMPT_BIN),mvdan.cc/gofumpt)
LINT_BIN = $(PROJECT_BIN)/golangci-lint
.PHONY: install-lint
install-lint:
$(call go-install,$(LINT_BIN),github.com/golangci/golangci-lint/cmd/golangci-lint)
GOVULN_BIN = $(PROJECT_BIN)/govulncheck
.PHONY: install-govuln
install-govuln:
$(call go-install,$(GOVULN_BIN),golang.org/x/vuln/cmd/govulncheck)
define go-install
@if [ ! -f $1 ] ; then \
echo "Installing $1 to the $(PROJECT_BIN) ..."; \
GOBIN=$(PROJECT_BIN) go install $2@latest; \
fi
endef