-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (56 loc) · 1.23 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
65
66
67
68
69
70
export GO111MODULE=on
GOOS := $(shell go env GOOS)
VERSION := $(shell git describe --tags --always)
BUILD_FLAGS := -ldflags="-X 'main.version=$(VERSION)'"
# update to main app path
APP_PATH := .\app\cmd\finder\file-finder.go
# determins the variables based on GOOS
ifeq ($(GOOS), windows)
RM = del /Q
HOME = $(shell echo %USERPROFILE%)
CONFIG_PATH = $(subst ,,$(HOME)\.golangci.yaml)
OUTPUT_PATH = C:\cli-tools
else
RM = rm -f
HOME = $(shell echo $$HOME)
CONFIG_PATH = $(HOME)/.golangci.yaml
OUTPUT_PATH = /usr/local/bin
endif
check-quality:
@make tidy
@make fmt
@make vet
#@make lint
lint:
@make fmt
@make vet
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=unit.coverage.out || (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) -o $(OUTPUT_PATH) $(APP_PATH)
all:
make check-quality
make test
make build
clean:
go clean
$(RM) *coverage*
$(RM) *report*
$(RM) *lint*
vendor:
go mod vendor