-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
43 lines (31 loc) · 874 Bytes
/
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
.PHONY: errgen
PKGS := $(shell go list ./... | grep -v go-errgen)
check: test lint vet fmt-check
check-ci: test vet fmt-check
test: errgen
go test -v -cover -race -coverprofile=coverage.txt -covermode=atomic $(PKGS)
test-coverage: errgen
go test -v -cover -coverprofile cover.out $(PKGS)
go tool cover -html=cover.out -o cover.html
lint:
golangci-lint run ./...
vet:
go vet $(PKGS)
fmt-check:
gofmt -l -s **/*.go | grep [^*][.]go$$; \
EXIT_CODE=$$?; \
if [ $$EXIT_CODE -eq 0 ]; then exit 1; fi; \
goimports -l **/*.go | grep [^*][.]go$$; \
EXIT_CODE=$$?; \
if [ $$EXIT_CODE -eq 0 ]; then exit 1; fi \
fmt:
gofmt -w -s **/*.go
goimports -w **/*.go
installdeps:
go mod vendor
go mod tidy
bootstrap: installdeps
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/moznion/go-errgen/cmd/errgen@latest
errgen:
go generate ./...