-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (50 loc) · 1.07 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
54
55
56
57
58
59
60
61
62
63
64
export GO111MODULE=on
GOOS := $(shell go env GOOS)
VERSION := $(shell git describe --tags --always)
BUILD_FLAGS := -ldflags="-X 'main.version=$(VERSION)'"
# determins the variables based on GOOS
ifeq ($(GOOS), windows)
RM = del /Q
HOME = $(shell echo %USERPROFILE%)
CONFIG_PATH = $(subst ,,$(HOME)\.golangci.yaml)
else
RM = rm -f
HOME = $(shell echo $$HOME)
CONFIG_PATH = $(HOME)/.golangci.yaml
endif
check-quality:
@make tidy
@make fmt
@make vet
#@make lint
lint:
golangci-lint run --config="$(CONFIG_PATH)" ./...
vet:
go vet ./...
fmt:
go fmt ./...
tidy:
go mod tidy
update-packages:
go get -u all
update-common:
go get github.com/ondrovic/common@latest
test:
make tidy
go test -v -timeout 10m ./... -coverprofile=coverage.out -json > report.json || (echo "Tests failed. See report.json for details." && exit 1)
coverage:
make test
go tool cover -html=coverage.out -o coverage.html
build:
go build $(BUILD_FLAGS)
all:
make check-quality
make test
make build
clean:
go clean
$(RM) coverage*
$(RM) report*
$(RM) lint*
vendor:
go mod vendor