-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
34 lines (24 loc) · 1.19 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
#@IgnoreInspection BashAddShebang
export APP=lookups
export ROOT=$(realpath $(dir $(lastword $(MAKEFILE_LIST))))
all: install format lint
install:
go mod download
check-formatter:
which gofumpt || GO111MODULE=off go get -u mvdan.cc/gofumpt
which goimports || GO111MODULE=off go get -u golang.org/x/tools/cmd/goimports
which godot || GO111MODULE=off go get -u github.com/tetafro/godot/cmd/godot
format: check-formatter
find $(ROOT) -type f -name "*.go" -not -path "$(ROOT)/vendor/*" | xargs -n 1 -I R goimports -w R
find $(ROOT) -type f -name "*.go" -not -path "$(ROOT)/vendor/*" | xargs -n 1 -I R gofmt -s -w R
find $(ROOT) -type f -name "*.go" -not -path "$(ROOT)/vendor/*" | xargs -n 1 -I R gofumpt -s -w R
find $(ROOT) -type f -name "*.go" -not -path "$(ROOT)/vendor/*" | xargs -n 1 -I R godot -w R
check-linter:
which golangci-lint || GO111MODULE=off curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.30.0
lint: check-linter
golangci-lint run --deadline 10m $(ROOT)/...
test:
go test -v -race -p 1 ./...
ci-test:
go test -v -race -p 1 -coverprofile=coverage.txt -covermode=atomic ./...
go tool cover -func coverage.txt