forked from golangci/golangci-lint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
118 lines (90 loc) · 3.56 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
.DEFAULT_GOAL = test
.PHONY: FORCE
# Build
fast_build: FORCE
go build -o golangci-lint ./cmd/golangci-lint
build_race: FORCE
go build -race -o golangci-lint ./cmd/golangci-lint
build: golangci-lint
clean:
rm -f golangci-lint test/path
rm -rf tools
.PHONY: fast_build build build_race clean
# Test
# until https://github.com/OpenPeeDeeP/depguard/issues/7 fixed
test: export GO111MODULE = off
test: export GOLANGCI_LINT_INSTALLED = true
test: build
GL_TEST_RUN=1 time ./golangci-lint run -v
GL_TEST_RUN=1 time ./golangci-lint run --fast --no-config -v --skip-dirs 'test/testdata_etc,pkg/golinters/goanalysis/(checker|passes)'
GL_TEST_RUN=1 time ./golangci-lint run --no-config -v --skip-dirs 'test/testdata_etc,pkg/golinters/goanalysis/(checker|passes)'
GL_TEST_RUN=1 time go test -v ./...
.PHONY: test
test_race:
go build -race -o golangci-lint ./cmd/golangci-lint
GL_TEST_RUN=1 ./golangci-lint run -v --deadline=5m
.PHONY: test_race
test_linters:
GL_TEST_RUN=1 go test -v ./test -count 1 -run TestSourcesFromTestdataWithIssuesDir/$T
.PHONY: test_linters
# Maintenance
generate: README.md docs/demo.svg install.sh pkg/logutils/mock_logutils/mock_log.go vendor
fast_generate: README.md vendor
maintainer-clean: clean
rm -f docs/demo.svg README.md install.sh pkg/logutils/mock_logutils/mock_log.go
rm -rf vendor
.PHONY: generate maintainer-clean
check_generated:
$(MAKE) --always-make generate
git checkout -- go.mod go.sum # can differ between go1.11 and go1.12
git checkout -- vendor/modules.txt # can differ between go1.12 and go1.13
git diff --exit-code # check no changes
.PHONY: check_generated
fast_check_generated:
$(MAKE) --always-make fast_generate
git checkout -- go.mod go.sum # can differ between go1.11 and go1.12
git checkout -- vendor/modules.txt # can differ between go1.12 and go1.13
git diff --exit-code # check no changes
.PHONY: fast_check_generated
release:
rm -rf dist
curl -sL https://git.io/goreleaser | bash
.PHONY: release
# Non-PHONY targets (real files)
golangci-lint: FORCE pkg/logutils/mock_logutils/mock_log.go
go build -o $@ ./cmd/golangci-lint
tools/mockgen: go.mod go.sum
GOBIN=$(CURDIR)/tools GO111MODULE=on go install github.com/golang/mock/mockgen
tools/goimports: go.mod go.sum
GOBIN=$(CURDIR)/tools GO111MODULE=on go install golang.org/x/tools/cmd/goimports
tools/go.mod:
@mkdir -p tools
@rm -f $@
cd tools && GO111MODULE=on go mod init local-tools
tools/godownloader: Makefile tools/go.mod
# https://github.com/goreleaser/godownloader/issues/133
cd tools && GOBIN=$(CURDIR)/tools GO111MODULE=off go get -u github.com/goreleaser/godownloader
tools/svg-term:
@mkdir -p tools
cd tools && npm ci
ln -sf node_modules/.bin/svg-term $@
tools/Dracula.itermcolors:
@mkdir -p tools
curl -fL -o $@ https://raw.githubusercontent.com/dracula/iterm/master/Dracula.itermcolors
docs/demo.svg: tools/svg-term tools/Dracula.itermcolors
PATH=$(CURDIR)/tools:$${PATH} svg-term --cast=183662 --out docs/demo.svg --window --width 110 --height 30 --from 2000 --to 20000 --profile ./tools/Dracula.itermcolors --term iterm2
install.sh: tools/godownloader .goreleaser.yml
PATH=$(CURDIR)/tools:$${PATH} tools/godownloader .goreleaser.yml | sed '/DO NOT EDIT/s/ on [0-9TZ:-]*//' > $@
README.md: FORCE golangci-lint
go run ./scripts/gen_readme/main.go
pkg/logutils/mock_logutils/mock_log.go: tools/mockgen tools/goimports pkg/logutils/log.go
@rm -f $@
PATH=$(CURDIR)/tools:$${PATH} go generate ./...
go.mod: FORCE
GO111MODULE=on go mod verify
GO111MODULE=on go mod tidy
go.sum: go.mod
.PHONY: vendor
vendor: go.mod go.sum
rm -rf vendor
GO111MODULE=on go mod vendor