-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
53 lines (43 loc) · 1.24 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
PACKAGES_PATH = $(shell go list -f '{{ .Dir }}' ./...)
.PHONY: all
all: require tidy fmt goimports vet staticcheck test
.PHONY: require
require:
@type "goimports" > /dev/null 2>&1 \
|| (echo 'goimports not found: to install it, run "go install golang.org/x/tools/cmd/goimports@latest"'; exit 1)
@type "staticcheck" > /dev/null 2>&1 \
|| (echo 'staticcheck not found: to install it, run "go install honnef.co/go/tools/cmd/staticcheck@latest"'; exit 1)
.PHONY: tidy
tidy:
@echo "=> Executing go mod tidy"
@go mod tidy
.PHONY: fmt
fmt:
@echo "=> Executing go fmt"
@go fmt ./...
.PHONY: goimports
goimports:
@echo "=> Executing goimports"
@goimports -w $(PACKAGES_PATH)
.PHONY: vet
vet:
@echo "=> Executing go vet"
@go vet ./...
.PHONY: staticcheck
staticcheck:
@echo "=> Executing staticcheck"
@staticcheck ./...
.PHONY: test
test:
@echo "=> Running tests"
@go test ./... -covermode=atomic -coverpkg=./... -count=1 -race -shuffle=on
.PHONY: test-cover
test-cover:
@echo "=> Running tests and generating report"
@go test ./... -covermode=atomic -coverprofile=/tmp/coverage.out -coverpkg=./... -count=1 -race -shuffle=on
@go tool cover -html=/tmp/coverage.out
.PHONY: build
build:
@echo "=> Building web h lib"
@go build .
@echo "=> Built OK"