-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
40 lines (28 loc) · 1.27 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
SOURCE_FILES?=$$(go list ./... | grep -v /vendor/ | grep -v /mocks/)
TEST_PATTERN?=.
TEST_OPTIONS?=-race -v
setup:
GO111MODULE=on go get mvdan.cc/gofumpt
go install -v golang.org/x/tools/cmd/goimports@latest
go install -v mvdan.cc/gofumpt@latest
go get -u golang.org/x/tools/cmd/cover
test:
echo 'mode: atomic' > coverage.txt && go list ./... | grep -v testing.go | xargs -n1 -I{} sh -c 'go test -v -failfast -p 1 -parallel 1 -timeout=600s -covermode=atomic -coverprofile=coverage.tmp {} && tail -n +2 coverage.tmp >> coverage.txt' && rm coverage.tmp
find-updates:
go list -u -m -json all | go-mod-outdated -update -direct
cover: test
go tool cover -html=coverage.txt
# don't open browser... go tool cover -html=coverage.txt -o coverage.html
fmt:
goimports -w . && gofumpt -l -w .
lint:
golangci-lint run --disable lll --disable interfacer --disable gochecknoglobals --disable exhaustivestruct --disable tagliatelle
ci: lint test
BUILD_TAG := $(shell git describe --tags 2>/dev/null)
BUILD_SHA := $(shell git rev-parse --short HEAD)
BUILD_DATE := $(shell date -u '+%Y/%m/%d:%H:%M:%S')
critic:
gocritic check ./...
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := build