1
1
PROJECT_ROOT =github.com/jaegertracing/jaeger
2
- # TOP_PKGS is used with 'go test'
3
- TOP_PKGS := $(shell go list ./... | \
4
- sed -E "s|${PROJECT_ROOT}/([^/]+) (/.*)?$$|./\1/...|g" | \
5
- sort | \
6
- uniq | \
7
- grep -v \
8
- -e github.com/jaegertracing/jaeger \
9
- -e ./thrift-gen \
10
- -e ./swagger-gen \
11
- -e ./proto-gen \
12
- -e ./examples \
13
- -e ./scripts \
14
- )
15
-
16
2
STORAGE_PKGS = ./plugin/storage/integration/...
17
3
18
4
# all .go files that are not auto-generated and should be auto-formatted and linted.
19
- ALL_SRC := $(shell find . -name " * .go" | \
20
- grep -v \
21
- -e vendor \
22
- -e /thrift-gen/ \
23
- -e /swagger-gen/ \
24
- -e /proto-gen/ \
25
- -e /examples/ \
26
- -e doc.go \
27
- -e model.pb.go \
28
- -e model_test.pb.go \
29
- -e ". * /\.. * " \
30
- -e ". * /_. * " \
31
- -e ". * /mocks. * " \
32
- )
5
+ ALL_SRC := $(shell find . -name ' * .go' \
6
+ -not -name 'doc.go' \
7
+ -not -name '_ * ' \
8
+ -not -name '. * ' \
9
+ -not -name 'mocks * ' \
10
+ -not -name ' * _test.go' \
11
+ -not -name 'model.pb.go' \
12
+ -not -name 'model_test.pb.go' \
13
+ -not -path './examples/ * ' \
14
+ -not -path './vendor/ * ' \
15
+ -not -path ' * /mocks/ * ' \
16
+ -not -path ' * / * -gen/ * ' \
17
+ -type f | \
18
+ sort )
33
19
34
20
# ALL_PKGS is used with 'go cover'
35
21
ALL_PKGS := $(shell go list $(sort $(dir $(ALL_SRC ) ) ) )
95
81
96
82
.PHONY : test
97
83
test : go-gen
98
- bash -c " set -e; set -o pipefail; $( GOTEST) $( TOP_PKGS ) | $( COLORIZE) "
84
+ bash -c " set -e; set -o pipefail; $( GOTEST) ./... | $( COLORIZE) "
99
85
100
86
.PHONY : integration-test
101
87
integration-test : go-gen
@@ -115,7 +101,7 @@ all-srcs:
115
101
cover : nocover
116
102
@echo pre-compiling tests
117
103
@time go test -i $(ALL_PKGS )
118
- @./scripts/cover.sh $(shell go list $( TOP_PKGS ) )
104
+ @./scripts/cover.sh $(shell go list ./... )
119
105
grep -E -v ' model.pb.*.go' cover.out > cover-nogen.out
120
106
mv cover-nogen.out cover.out
121
107
go tool cover -html=cover.out -o cover.html
@@ -133,33 +119,20 @@ fmt:
133
119
134
120
.PHONY : lint-gosec
135
121
lint-gosec :
136
- $(GOSEC ) $( TOP_PKGS )
122
+ $(GOSEC ) ./...
137
123
138
124
.PHONY : lint
139
125
lint : lint-gosec
140
- $(GOVET ) $( TOP_PKGS )
141
- $(GOSIMPLE ) $( TOP_PKGS )
126
+ $(GOVET ) ./...
127
+ $(GOSIMPLE ) ./...
142
128
@cat /dev/null > $(LINT_LOG )
143
- $(GOLINT ) $(TOP_PKGS ) | \
144
- grep -v \
145
- -e pkg/es/wrapper.go \
146
- -e /mocks/ \
147
- -e thrift-gen \
148
- -e thrift-0.9.2 \
149
- -e model.pb.go \
150
- -e model_test.pb.go \
151
- >> $(LINT_LOG ) \
152
- || true ;
129
+ $(GOLINT ) $(ALL_SRC ) >> $(LINT_LOG ) || true ;
153
130
@[ ! -s " $( LINT_LOG) " ] || (echo " Lint Failures" | cat - $( LINT_LOG) && false)
154
131
@$(GOFMT ) -e -s -l $(ALL_SRC ) > $(FMT_LOG )
155
132
@./scripts/updateLicenses.sh >> $(FMT_LOG )
156
133
@./scripts/import-order-cleanup.sh stdout > $(IMPORT_LOG )
157
134
@[ ! -s " $( FMT_LOG) " -a ! -s " $( IMPORT_LOG) " ] || (echo " Go fmt, license check, or import ordering failures, run 'make fmt'" | cat - $( FMT_LOG) && false)
158
135
159
- .PHONY : install-glide
160
- install-glide :
161
- @echo " Jaeger has migrated to dep, please run 'make install-dep'" 1>&2
162
-
163
136
.PHONY : install-dep
164
137
install-dep :
165
138
@which dep > /dev/null || curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
0 commit comments