@@ -14,7 +14,7 @@ GOTESTFLAGS?=-v
14
14
GOMODFLAG?=-mod =readonly
15
15
16
16
PYTHON_ENV? =.
17
- PYTHON_VENV_DIR: =$(PYTHON_ENV ) /build/ve/$(shell $( GO ) env GOOS)
17
+ PYTHON_VENV_DIR: =$(PYTHON_ENV ) /build/ve/$(shell go env GOOS)
18
18
PYTHON_BIN: =$(PYTHON_VENV_DIR ) /bin
19
19
PYTHON =$(PYTHON_BIN ) /python
20
20
CURRENT_DIR =$(shell dirname $(shell readlink -f $(firstword $(MAKEFILE_LIST ) ) ) )
@@ -50,7 +50,7 @@ LDFLAGS := \
50
50
.PHONY : $(APM_SERVER_BINARIES )
51
51
$(APM_SERVER_BINARIES ) :
52
52
env CGO_ENABLED=0 GOOS=$(GOOS ) GOARCH=$(GOARCH ) \
53
- $( GO ) build -o $@ -trimpath $(GOFLAGS ) $(GOMODFLAG ) -ldflags " $( LDFLAGS) " ./x-pack/apm-server
53
+ go build -o $@ -trimpath $(GOFLAGS ) $(GOMODFLAG ) -ldflags " $( LDFLAGS) " ./x-pack/apm-server
54
54
55
55
build/apm-server-linux-% : GOOS=linux
56
56
build/apm-server-darwin-% : GOOS=darwin
@@ -65,24 +65,24 @@ GOVERSIONINFO_FLAGS := \
65
65
66
66
build/apm-server-windows-amd64.exe : x-pack/apm-server/versioninfo_windows_amd64.syso
67
67
x-pack/apm-server/versioninfo_windows_amd64.syso : GOVERSIONINFO_FLAGS+=-64
68
- x-pack/apm-server/versioninfo_% .syso : $(GOVERSIONINFO ) $( GITREFFILE ) packaging/versioninfo.json
69
- $( GOVERSIONINFO ) -o $@ $(GOVERSIONINFO_FLAGS ) packaging/versioninfo.json
68
+ x-pack/apm-server/versioninfo_% .syso : $(GITREFFILE ) packaging/versioninfo.json
69
+ go run -modfile=tools/go.mod github.com/josephspurrier/goversioninfo/cmd/goversioninfo -o $@ $(GOVERSIONINFO_FLAGS ) packaging/versioninfo.json
70
70
71
71
.PHONY : apm-server
72
- apm-server : build/apm-server-$(shell $( GO ) env GOOS) -$(shell $( GO ) env GOARCH)
72
+ apm-server : build/apm-server-$(shell go env GOOS) -$(shell go env GOARCH)
73
73
@cp $^ $@
74
74
75
75
.PHONY : apm-server-oss
76
76
apm-server-oss :
77
- @$( GO ) build $(GOMODFLAG ) -o $@ ./cmd/apm-server
77
+ @go build $(GOMODFLAG ) -o $@ ./cmd/apm-server
78
78
79
79
.PHONY : test
80
80
test :
81
- @$( GO ) test $(GOMODFLAG ) $(GOTESTFLAGS ) ./...
81
+ @go test $(GOMODFLAG ) $(GOTESTFLAGS ) ./...
82
82
83
83
.PHONY : system-test
84
84
system-test :
85
- @ (cd systemtest; $( GO ) test $( GOMODFLAG) $( GOTESTFLAGS) -timeout=20m ./...)
85
+ @ (cd systemtest; go test $( GOMODFLAG) $( GOTESTFLAGS) -timeout=20m ./...)
86
86
87
87
.PHONY :
88
88
clean :
@@ -97,7 +97,7 @@ check-full: update check staticcheck
97
97
98
98
.PHONY : check-approvals
99
99
check-approvals :
100
- @$( GO ) run -modfile=tools/go.mod github.com/elastic/apm-tools/cmd/check-approvals
100
+ @go run -modfile=tools/go.mod github.com/elastic/apm-tools/cmd/check-approvals
101
101
102
102
check : check-fmt check-headers check-git-diff
103
103
@@ -109,7 +109,7 @@ BENCH_BENCHTIME?=100ms
109
109
BENCH_COUNT? =1
110
110
.PHONY : bench
111
111
bench :
112
- @$( GO ) test -count=$(BENCH_COUNT ) -benchmem -run=XXX -benchtime=$(BENCH_BENCHTIME ) -bench=' .*' ./...
112
+ @go test -count=$(BENCH_COUNT ) -benchmem -run=XXX -benchtime=$(BENCH_BENCHTIME ) -bench=' .*' ./...
113
113
114
114
# #############################################################################
115
115
# Rules for updating config files, etc.
@@ -125,13 +125,13 @@ apm-server.docker.yml: apm-server.yml
125
125
126
126
.PHONY : go-generate
127
127
go-generate :
128
- @cd cmd/intake-receiver && APM_SERVER_VERSION=$(APM_SERVER_VERSION ) $( GO ) generate .
128
+ @cd cmd/intake-receiver && APM_SERVER_VERSION=$(APM_SERVER_VERSION ) go generate .
129
129
130
130
.PHONY : add-headers
131
- add-headers : $( GOLICENSER )
131
+ add-headers :
132
132
ifndef CHECK_HEADERS_DISABLED
133
- @$(GOLICENSER) -exclude x-pack
134
- @$(GOLICENSER) -license Elasticv2 x-pack
133
+ @go run -modfile=tools/go.mod github.com/elastic/go-licenser -exclude x-pack
134
+ @go run -modfile=tools/go.mod github.com/elastic/go-licenser -license Elasticv2 x-pack
135
135
endif
136
136
137
137
# # get-version : Get the apm server version
@@ -156,10 +156,10 @@ docs: tf-docs
156
156
sh script/build_apm_docs.sh apm-server docs/index.asciidoc build
157
157
158
158
.PHONY : tf-docs
159
- tf-docs : $(TERRAFORMDOCS ) $( addsuffix /README.md,$(wildcard testing/infra/terraform/modules/* ) )
159
+ tf-docs : $(addsuffix /README.md,$(wildcard testing/infra/terraform/modules/* ) )
160
160
161
161
testing/infra/terraform/modules/% /README.md : .FORCE
162
- $( TERRAFORMDOCS ) markdown --hide-empty --header-from header.md --output-file=README.md --output-mode replace $(subst README.md,,$@ )
162
+ go run -modfile=tools/go.mod github.com/terraform-docs/terraform-docs markdown --hide-empty --header-from header.md --output-file=README.md --output-mode replace $(subst README.md,,$@ )
163
163
164
164
.PHONY : .FORCE
165
165
.FORCE :
@@ -169,8 +169,8 @@ testing/infra/terraform/modules/%/README.md: .FORCE
169
169
# TODO in the future we should probably trigger the updates from apm-data,
170
170
# and just keep the JSON Schema there.
171
171
docs/spec : go.mod
172
- @$( GO ) mod download github.com/elastic/apm-data
173
- rsync -v --delete --filter=' P spec/openapi/' --chmod=Du+rwx,go+rx --chmod=Fu+rw,go+r -r $$($( GO ) list -m -f {{.Dir}} github.com/elastic/apm-data) /input/elasticapm/docs/spec ./docs
172
+ @go mod download github.com/elastic/apm-data
173
+ rsync -v --delete --filter=' P spec/openapi/' --chmod=Du+rwx,go+rx --chmod=Fu+rw,go+r -r $$(go list -m -f {{.Dir}} github.com/elastic/apm-data ) /input/elasticapm/docs/spec ./docs
174
174
175
175
# #############################################################################
176
176
# Beats synchronisation.
@@ -181,11 +181,11 @@ BEATS_MODULE:=github.com/elastic/beats/v7
181
181
182
182
.PHONY : update-beats
183
183
update-beats : update-beats-module update
184
- @echo --- Use this commit message: Update to elastic/beats@$(shell $( GO ) list -m -f {{.Version}} $(BEATS_MODULE ) | cut -d- -f3)
184
+ @echo --- Use this commit message: Update to elastic/beats@$(shell go list -m -f {{.Version}} $(BEATS_MODULE ) | cut -d- -f3)
185
185
186
186
.PHONY : update-beats-module
187
187
update-beats-module :
188
- $( GO ) get -d $(BEATS_MODULE ) @$(BEATS_VERSION ) && $( GO ) mod tidy
188
+ go get -d $(BEATS_MODULE ) @$(BEATS_VERSION ) && go mod tidy
189
189
190
190
# #############################################################################
191
191
# Linting, style-checking, license header checks, etc.
@@ -198,14 +198,14 @@ update-beats-module:
198
198
STATICCHECK_CHECKS? =all,-ST1000
199
199
200
200
.PHONY : staticcheck
201
- staticcheck : $( STATICCHECK )
202
- $( STATICCHECK ) -checks=$(STATICCHECK_CHECKS ) ./...
201
+ staticcheck :
202
+ go run -modfile=tools/go.mod honnef.co/go/tools/cmd/staticcheck -checks=$(STATICCHECK_CHECKS ) ./...
203
203
204
204
.PHONY : check-headers
205
- check-headers : $( GOLICENSER )
205
+ check-headers :
206
206
ifndef CHECK_HEADERS_DISABLED
207
- @$(GOLICENSER) -d -exclude build -exclude x-pack
208
- @$(GOLICENSER) -d -exclude build -license Elasticv2 x-pack
207
+ @go run -modfile=tools/go.mod github.com/elastic/go-licenser -d -exclude build -exclude x-pack
208
+ @go run -modfile=tools/go.mod github.com/elastic/go-licenser -d -exclude build -license Elasticv2 x-pack
209
209
endif
210
210
211
211
.PHONY : check-docker-compose
@@ -215,23 +215,23 @@ check-docker-compose:
215
215
.PHONY : check-gofmt gofmt
216
216
check-fmt : check-gofmt
217
217
fmt : gofmt
218
- check-gofmt : $( GOIMPORTS )
219
- @PATH= $( GOOSBUILD ) : $( PATH ) sh script/check_goimports.sh
220
- gofmt : $( GOIMPORTS ) add-headers
218
+ check-gofmt :
219
+ @sh script/check_goimports.sh
220
+ gofmt : add-headers
221
221
@echo " fmt - goimports: Formatting Go code"
222
- @PATH= $( GOOSBUILD ) : $( PATH ) GOIMPORTSFLAGS=-w sh script/goimports.sh
222
+ @GOIMPORTSFLAGS=-w sh script/goimports.sh
223
223
224
224
# #############################################################################
225
225
# NOTICE.txt & dependencies.csv generation.
226
226
# #############################################################################
227
227
228
228
MODULE_DEPS =$(sort $(shell \
229
- $( GO ) list -deps -tags=darwin,linux,windows -f "{{with .Module}}{{if not .Main}}{{.Path}}{{end}}{{end}}" ./x-pack/apm-server) )
229
+ go list -deps -tags=darwin,linux,windows -f "{{with .Module}}{{if not .Main}}{{.Path}}{{end}}{{end}}" ./x-pack/apm-server) )
230
230
231
231
notice : NOTICE.txt
232
232
NOTICE.txt build/dependencies-$(APM_SERVER_VERSION ) .csv : go.mod tools/go.mod
233
233
mkdir -p build/
234
- $( GO ) list -m -json $(MODULE_DEPS ) | go run -modfile=tools/go.mod go.elastic.co/go-licence-detector \
234
+ go list -m -json $(MODULE_DEPS ) | go run -modfile=tools/go.mod go.elastic.co/go-licence-detector \
235
235
-includeIndirect \
236
236
-overrides tools/notice/overrides.json \
237
237
-rules tools/notice/rules.json \
@@ -281,7 +281,7 @@ $(PYTHON_BIN)/esrally: $(PYTHON_BIN)
281
281
.PHONY : testing/rally/corpora
282
282
testing/rally/corpora :
283
283
@rm -fr testing/rally/corpora && mkdir testing/rally/corpora
284
- @cd systemtest/cmd/gencorpora && $( GO ) run . -write-dir $(CURRENT_DIR ) /testing/rally/corpora/ -replay-count $(RALLY_GENCORPORA_REPLAY_COUNT )
284
+ @cd systemtest/cmd/gencorpora && go run . -write-dir $(CURRENT_DIR ) /testing/rally/corpora/ -replay-count $(RALLY_GENCORPORA_REPLAY_COUNT )
285
285
286
286
# #############################################################################
287
287
# Smoke tests -- Basic smoke tests for APM Server.
0 commit comments