-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (34 loc) · 1.43 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
#!/usr/bin/make -f
all: format lint test
go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
./contrib/scripts/go-mod-all.sh verify
./contrib/scripts/go-mod-all.sh tidy
@echo "--> Download go modules to local cache"
./contrib/scripts/go-mod-all.sh download
.PHONY: go.sum
###############################################################################
### Linting ###
###############################################################################
golangci_version=v1.60.3
lint-install:
@if golangci-lint version --format json | jq -r .version | sed 's/^v//; s/^/v/' | grep $(golangci_version); then \
echo "golangci-lint $(golangci_version) is already installed"; \
else \
echo "Installing golangci-lint $(golangci_version)"; \
go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version); \
fi
lint: lint-install
@echo "--> Running linter"
golangci-lint run -v --out-format=tab
format: lint-install
golangci-lint run -v --out-format=tab --fix
###############################################################################
### Tests ###
###############################################################################
test:
@echo "--> Running tests"
./contrib/scripts/go-test-all.sh
test-count:
./contrib/scripts/go-test-all.sh -cpu 1 -count 1 -cover
.PHONY: test