-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (43 loc) · 1.45 KB
/
Makefile
File metadata and controls
56 lines (43 loc) · 1.45 KB
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
.PHONY: build
build:
go build .
.PHONY: test
test: unit-test
.PHONY: unit-test
unit-test:
go test -v -vet=all ./...
.PHONY: short-test
short-test:
go test -v -short ./...
.PHONY: integration-test
integration-test:
SUITE=integration go test -v -timeout 10m ./internal/integrationtest/$(SUBTEST)...
.PHONY: itest
itest: integration-test
.PHONY: lint
lint: tools/golangci-lint
tools/golangci-lint run -v
.PHONY: checks
checks: check_tidy check_vuln check_modern
.PHONY: check_tidy
check_tidy:
go mod tidy
# Verify that `go mod tidy` didn't introduce any changes. Run go mod tidy before pushing.
git diff --exit-code --stat go.mod go.sum
.PHONY: check_vuln
check_vuln:
go run golang.org/x/vuln/cmd/govulncheck@v1.1.4 ./...
.PHONY: check_modern
check_modern:
test -z "$$(go fix -diff ./... | tee /dev/stderr)"
# non-zero exit status on issues found
# nb: modernize is not part of golangci-lint yet - https://github.com/golangci/golangci-lint/issues/686
# Tools targets
tools:
mkdir -p tools
tools/golangci-lint: tools
# Version must be the same as in golangci-lint Github action
# We install golangci-lint as recommended in the docs. See the same docs for a discussion about go run and
# go get -tool alternatives - https://golangci-lint.run/docs/welcome/install/ .
# Delete tools/golangci-lint if this target is updated (may be automated in the future)
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b ./tools v2.11.4