1# Lint rules to ignore
2LINTIGNORESINGLEFIGHT='internal/sync/singleflight/singleflight.go:.+error should be the last type'
3LINT_IGNORE_S3MANAGER_INPUT='feature/s3/manager/upload.go:.+struct field SSEKMSKeyId should be SSEKMSKeyID'
4# Names of these are tied to endpoint rules and they're internal so ignore them
5LINT_IGNORE_AWSRULESFN_ARN='internal/endpoints/awsrulesfn/arn.go'
6LINT_IGNORE_AWSRULESFN_PARTITION='internal/endpoints/awsrulesfn/partition.go'
7LINT_IGNORE_PRIVATE_METRICS='aws/middleware/private/metrics'
8
9UNIT_TEST_TAGS=
10BUILD_TAGS=-tags "example,codegen,integration,ec2env,perftest"
11SNAPSHOT_TAGS=-tags "snapshot"
12
13SMITHY_GO_SRC ?= $(shell pwd)/../smithy-go
14
15SDK_MIN_GO_VERSION ?= 1.20
16
17EACHMODULE_FAILFAST ?= true
18EACHMODULE_FAILFAST_FLAG=-fail-fast=${EACHMODULE_FAILFAST}
19
20EACHMODULE_CONCURRENCY ?= 1
21EACHMODULE_CONCURRENCY_FLAG=-c ${EACHMODULE_CONCURRENCY}
22
23EACHMODULE_SKIP ?=
24EACHMODULE_SKIP_FLAG=-skip="${EACHMODULE_SKIP}"
25
26EACHMODULE_FLAGS=${EACHMODULE_CONCURRENCY_FLAG} ${EACHMODULE_FAILFAST_FLAG} ${EACHMODULE_SKIP_FLAG}
27
28# SDK's Core and client packages that are compatible with Go 1.9+.
29SDK_CORE_PKGS=./aws/... ./internal/...
30SDK_CLIENT_PKGS=./service/...
31SDK_COMPA_PKGS=${SDK_CORE_PKGS} ${SDK_CLIENT_PKGS}
32
33# SDK additional packages that are used for development of the SDK.
34SDK_EXAMPLES_PKGS=
35SDK_ALL_PKGS=${SDK_COMPA_PKGS} ${SDK_EXAMPLES_PKGS}
36
37RUN_NONE=-run NONE
38RUN_INTEG=-run '^TestInteg_'
39
40CODEGEN_RESOURCES_PATH=$(shell pwd)/codegen/smithy-aws-go-codegen/src/main/resources/software/amazon/smithy/aws/go/codegen
41CODEGEN_API_MODELS_PATH=$(shell pwd)/codegen/sdk-codegen/aws-models
42ENDPOINTS_JSON=${CODEGEN_RESOURCES_PATH}/endpoints.json
43ENDPOINT_PREFIX_JSON=${CODEGEN_RESOURCES_PATH}/endpoint-prefix.json
44
45LICENSE_FILE=$(shell pwd)/LICENSE.txt
46
47SMITHY_GO_VERSION ?=
48PRE_RELEASE_VERSION ?=
49RELEASE_MANIFEST_FILE ?=
50RELEASE_CHGLOG_DESC_FILE ?=
51
52REPOTOOLS_VERSION ?= latest
53REPOTOOLS_MODULE = github.com/awslabs/aws-go-multi-module-repository-tools
54REPOTOOLS_CMD_ANNOTATE_STABLE_GEN = ${REPOTOOLS_MODULE}/cmd/annotatestablegen@${REPOTOOLS_VERSION}
55REPOTOOLS_CMD_MAKE_RELATIVE = ${REPOTOOLS_MODULE}/cmd/makerelative@${REPOTOOLS_VERSION}
56REPOTOOLS_CMD_CALCULATE_RELEASE = ${REPOTOOLS_MODULE}/cmd/calculaterelease@${REPOTOOLS_VERSION}
57REPOTOOLS_CMD_UPDATE_REQUIRES = ${REPOTOOLS_MODULE}/cmd/updaterequires@${REPOTOOLS_VERSION}
58REPOTOOLS_CMD_UPDATE_MODULE_METADATA = ${REPOTOOLS_MODULE}/cmd/updatemodulemeta@${REPOTOOLS_VERSION}
59REPOTOOLS_CMD_GENERATE_CHANGELOG = ${REPOTOOLS_MODULE}/cmd/generatechangelog@${REPOTOOLS_VERSION}
60REPOTOOLS_CMD_CHANGELOG = ${REPOTOOLS_MODULE}/cmd/changelog@${REPOTOOLS_VERSION}
61REPOTOOLS_CMD_TAG_RELEASE = ${REPOTOOLS_MODULE}/cmd/tagrelease@${REPOTOOLS_VERSION}
62REPOTOOLS_CMD_EDIT_MODULE_DEPENDENCY = ${REPOTOOLS_MODULE}/cmd/editmoduledependency@${REPOTOOLS_VERSION}
63
64REPOTOOLS_CALCULATE_RELEASE_VERBOSE ?= false
65REPOTOOLS_CALCULATE_RELEASE_VERBOSE_FLAG=-v=${REPOTOOLS_CALCULATE_RELEASE_VERBOSE}
66
67REPOTOOLS_CALCULATE_RELEASE_ADDITIONAL_ARGS ?=
68
69ifneq ($(PRE_RELEASE_VERSION),)
70 REPOTOOLS_CALCULATE_RELEASE_ADDITIONAL_ARGS += -preview=${PRE_RELEASE_VERSION}
71endif
72
73.PHONY: all
74all: generate unit
75
76###################
77# Code Generation #
78###################
79.PHONY: generate smithy-generate smithy-build smithy-build-% smithy-clean smithy-go-publish-local format \
80gen-config-asserts gen-repo-mod-replace gen-mod-replace-smithy gen-mod-dropreplace-smithy-% gen-aws-ptrs tidy-modules-% \
81add-module-license-files sync-models sync-endpoints-model sync-endpoints.json clone-v1-models gen-internal-codegen \
82sync-api-models copy-attributevalue-feature min-go-version-% update-requires smithy-annotate-stable \
83update-module-metadata download-modules-%
84
85generate: smithy-generate update-requires gen-repo-mod-replace update-module-metadata smithy-annotate-stable \
86gen-config-asserts gen-internal-codegen copy-attributevalue-feature gen-mod-dropreplace-smithy-. min-go-version-. \
87tidy-modules-. add-module-license-files gen-aws-ptrs format
88
89generate-tmpreplace-smithy: smithy-generate update-requires gen-repo-mod-replace update-module-metadata smithy-annotate-stable \
90gen-config-asserts gen-internal-codegen copy-attributevalue-feature gen-mod-replace-smithy-. min-go-version-. \
91tidy-modules-. add-module-license-files gen-aws-ptrs format gen-mod-dropreplace-smithy-. reset-sum
92
93reset-sum:
94 find . -name go.sum -exec git checkout -- {} \;
95
96smithy-generate:
97 cd codegen && ./gradlew clean build -Plog-tests && ./gradlew clean
98
99smithy-build:
100 cd codegen && ./gradlew clean build -Plog-tests
101
102smithy-build-%:
103 @# smithy-build- command that uses the pattern to define build filter that
104 @# the smithy API model service id starts with. Strips off the
105 @# "smithy-build-".
106 @#
107 @# e.g. smithy-build-com.amazonaws.rds
108 @# e.g. smithy-build-com.amazonaws.rds#AmazonRDSv19
109 cd codegen && \
110 SMITHY_GO_BUILD_API="$(subst smithy-build-,,$@)" ./gradlew clean build -Plog-tests
111
112smithy-annotate-stable:
113 go run ${REPOTOOLS_CMD_ANNOTATE_STABLE_GEN}
114
115smithy-clean:
116 cd codegen && ./gradlew clean
117
118smithy-go-publish-local:
119 rm -rf /tmp/smithy-go-local
120 git clone https://github.com/aws/smithy-go /tmp/smithy-go-local
121 make -C /tmp/smithy-go-local smithy-clean smithy-publish-local
122
123format:
124 gofmt -w -s .
125
126gen-config-asserts:
127 @echo "Generating SDK config package implementor assertions"
128 cd config \
129 && go mod tidy \
130 && go generate
131
132gen-internal-codegen:
133 @echo "Generating internal/codegen"
134 cd internal/codegen \
135 && go mod tidy \
136 && go generate
137
138gen-repo-mod-replace:
139 @echo "Generating go.mod replace for repo modules"
140 go run ${REPOTOOLS_CMD_MAKE_RELATIVE}
141
142gen-mod-replace-smithy-%:
143 @# gen-mod-replace-smithy- command that uses the pattern to define build filter that
144 @# for modules to add replace to. Strips off the "gen-mod-replace-smithy-".
145 @#
146 @# SMITHY_GO_SRC environment variable is the path to add replace to
147 @#
148 @# e.g. gen-mod-replace-smithy-service_ssooidc
149 cd ./internal/repotools/cmd/eachmodule \
150 && go run . -p $(subst _,/,$(subst gen-mod-replace-smithy-,,$@)) ${EACHMODULE_FLAGS} \
151 "go mod edit -replace github.com/aws/smithy-go=${SMITHY_GO_SRC}"
152
153gen-mod-dropreplace-smithy-%:
154 @# gen-mod-dropreplace-smithy- command that uses the pattern to define build filter that
155 @# for modules to add replace to. Strips off the "gen-mod-dropreplace-smithy-".
156 @#
157 @# e.g. gen-mod-dropreplace-smithy-service_ssooidc
158 cd ./internal/repotools/cmd/eachmodule \
159 && go run . -p $(subst _,/,$(subst gen-mod-dropreplace-smithy-,,$@)) ${EACHMODULE_FLAGS} \
160 "go mod edit -dropreplace github.com/aws/smithy-go"
161
162gen-aws-ptrs:
163 cd aws && go generate
164
165tidy-modules-%:
166 @# tidy command that uses the pattern to define the root path that the
167 @# module testing will start from. Strips off the "tidy-modules-" and
168 @# replaces all "_" with "/".
169 @#
170 @# e.g. tidy-modules-internal_protocoltest
171 cd ./internal/repotools/cmd/eachmodule \
172 && go run . -p $(subst _,/,$(subst tidy-modules-,,$@)) ${EACHMODULE_FLAGS} \
173 "go mod tidy"
174
175download-modules-%:
176 @# download command that uses the pattern to define the root path that the
177 @# module testing will start from. Strips off the "download-modules-" and
178 @# replaces all "_" with "/".
179 @#
180 @# e.g. download-modules-internal_protocoltest
181 cd ./internal/repotools/cmd/eachmodule \
182 && go run . -p $(subst _,/,$(subst download-modules-,,$@)) ${EACHMODULE_FLAGS} \
183 "go mod download all"
184
185add-module-license-files:
186 cd internal/repotools/cmd/eachmodule && \
187 go run . -skip-root \
188 "cp $(LICENSE_FILE) ."
189
190sync-models: sync-endpoints-model sync-api-models
191
192sync-endpoints-model: sync-endpoints.json
193
194sync-endpoints.json:
195 [[ ! -z "${ENDPOINTS_MODEL}" ]] && cp ${ENDPOINTS_MODEL} ${ENDPOINTS_JSON} || echo "ENDPOINTS_MODEL not set, must not be empty"
196
197clone-v1-models:
198 rm -rf /tmp/aws-sdk-go-model-sync
199 git clone https://github.com/aws/aws-sdk-go.git --depth 1 /tmp/aws-sdk-go-model-sync
200
201sync-api-models:
202 cd internal/repotools/cmd/syncAPIModels && \
203 go run . \
204 -m ${API_MODELS} \
205 -o ${CODEGEN_API_MODELS_PATH}
206
207copy-attributevalue-feature:
208 cd ./feature/dynamodbstreams/attributevalue && \
209 find . -name "*.go" | grep -v "doc.go" | xargs -I % rm % && \
210 find ../../dynamodb/attributevalue -name "*.go" | grep -v "doc.go" | xargs -I % cp % . && \
211 ls *.go | grep -v "convert.go" | grep -v "doc.go" | \
212 xargs -I % sed -i.bk -E 's:github.com/aws/aws-sdk-go-v2/(service|feature)/dynamodb:github.com/aws/aws-sdk-go-v2/\1/dynamodbstreams:g' % && \
213 ls *.go | grep -v "convert.go" | grep -v "doc.go" | \
214 xargs -I % sed -i.bk 's:DynamoDB:DynamoDBStreams:g' % && \
215 ls *.go | grep -v "doc.go" | \
216 xargs -I % sed -i.bk 's:dynamodb\.:dynamodbstreams.:g' % && \
217 sed -i.bk 's:streams\.:ddbtypes.:g' "convert.go" && \
218 sed -i.bk 's:ddb\.:streams.:g' "convert.go" && \
219 sed -i.bk 's:ddbtypes\.:ddb.:g' "convert.go" &&\
220 sed -i.bk 's:Streams::g' "convert.go" && \
221 rm -rf ./*.bk && \
222 go mod tidy && \
223 gofmt -w -s . && \
224 go test .
225
226min-go-version-%:
227 cd ./internal/repotools/cmd/eachmodule \
228 && go run . -p $(subst _,/,$(subst min-go-version-,,$@)) ${EACHMODULE_FLAGS} \
229 "go mod edit -go=${SDK_MIN_GO_VERSION}"
230
231update-requires:
232 go run ${REPOTOOLS_CMD_UPDATE_REQUIRES}
233
234update-module-metadata:
235 go run ${REPOTOOLS_CMD_UPDATE_MODULE_METADATA}
236
237################
238# Unit Testing #
239################
240.PHONY: unit unit-race unit-test unit-race-test unit-race-modules-% unit-modules-% build build-modules-% \
241go-build-modules-% test test-race-modules-% test-modules-% cachedep cachedep-modules-% api-diff-modules-%
242
243unit: lint unit-modules-.
244unit-race: lint unit-race-modules-.
245
246unit-test: test-modules-.
247unit-race-test: test-race-modules-.
248
249unit-race-modules-%:
250 @# unit command that uses the pattern to define the root path that the
251 @# module testing will start from. Strips off the "unit-race-modules-" and
252 @# replaces all "_" with "/".
253 @#
254 @# e.g. unit-race-modules-internal_protocoltest
255 cd ./internal/repotools/cmd/eachmodule \
256 && go run . -p $(subst _,/,$(subst unit-race-modules-,,$@)) ${EACHMODULE_FLAGS} \
257 "go vet ${BUILD_TAGS} --all ./..." \
258 "go test ${BUILD_TAGS} ${RUN_NONE} ./..." \
259 "go test -timeout=2m ${UNIT_TEST_TAGS} -race -cpu=4 ./..."
260
261unit-modules-%:
262 @# unit command that uses the pattern to define the root path that the
263 @# module testing will start from. Strips off the "unit-modules-" and
264 @# replaces all "_" with "/".
265 @#
266 @# e.g. unit-modules-internal_protocoltest
267 cd ./internal/repotools/cmd/eachmodule \
268 && go run . -p $(subst _,/,$(subst unit-modules-,,$@)) ${EACHMODULE_FLAGS} \
269 "go vet ${BUILD_TAGS} --all ./..." \
270 "go test ${BUILD_TAGS} ${RUN_NONE} ./..." \
271 "go test -timeout=2m ${UNIT_TEST_TAGS} ./..."
272
273build: build-modules-.
274
275build-modules-%:
276 @# build command that uses the pattern to define the root path that the
277 @# module testing will start from. Strips off the "build-modules-" and
278 @# replaces all "_" with "/".
279 @#
280 @# e.g. build-modules-internal_protocoltest
281 cd ./internal/repotools/cmd/eachmodule \
282 && go run . -p $(subst _,/,$(subst build-modules-,,$@)) ${EACHMODULE_FLAGS} \
283 "go test ${BUILD_TAGS} ${RUN_NONE} ./..."
284
285go-build-modules-%:
286 @# build command that uses the pattern to define the root path that the
287 @# module testing will start from. Strips off the "build-modules-" and
288 @# replaces all "_" with "/".
289 @#
290 @# Validates that all modules in the repo have buildable Go files.
291 @#
292 @# e.g. go-build-modules-internal_protocoltest
293 cd ./internal/repotools/cmd/eachmodule \
294 && go run . -p $(subst _,/,$(subst go-build-modules-,,$@)) ${EACHMODULE_FLAGS} \
295 "go build ${BUILD_TAGS} ./..."
296
297test: test-modules-.
298
299test-race-modules-%:
300 @# Test command that uses the pattern to define the root path that the
301 @# module testing will start from. Strips off the "test-race-modules-" and
302 @# replaces all "_" with "/".
303 @#
304 @# e.g. test-race-modules-internal_protocoltest
305 cd ./internal/repotools/cmd/eachmodule \
306 && go run . -p $(subst _,/,$(subst test-race-modules-,,$@)) ${EACHMODULE_FLAGS} \
307 "go test -timeout=2m ${UNIT_TEST_TAGS} -race -cpu=4 ./..."
308
309test-modules-%:
310 @# Test command that uses the pattern to define the root path that the
311 @# module testing will start from. Strips off the "test-modules-" and
312 @# replaces all "_" with "/".
313 @#
314 @# e.g. test-modules-internal_protocoltest
315 cd ./internal/repotools/cmd/eachmodule \
316 && go run . -p $(subst _,/,$(subst test-modules-,,$@)) ${EACHMODULE_FLAGS} \
317 "go test -timeout=2m ${UNIT_TEST_TAGS} ./..."
318
319test-check-snapshot-%:
320 cd ./internal/repotools/cmd/eachmodule \
321 && go run . -p $(subst _,/,$(subst test-check-snapshot-,,$@)) ${EACHMODULE_FLAGS} \
322 "go test ${SNAPSHOT_TAGS} -run TestCheckSnapshot ./..."
323
324test-update-snapshot-%:
325 cd ./internal/repotools/cmd/eachmodule \
326 && go run . -p $(subst _,/,$(subst test-update-snapshot-,,$@)) ${EACHMODULE_FLAGS} \
327 "go test ${SNAPSHOT_TAGS} -run TestUpdateSnapshot ./..."
328
329test-ci-check-snapshot-%:
330 cd ./internal/repotools/cmd/eachmodule \
331 && go run . -p $(subst _,/,$(subst test-ci-check-snapshot-,,$@)) ${EACHMODULE_FLAGS} \
332 "go test ${SNAPSHOT_TAGS} -run TestCheckSnapshot -failfast ./..."
333
334cachedep: cachedep-modules-.
335
336cachedep-modules-%:
337 @# build command that uses the pattern to define the root path that the
338 @# module caching will start from. Strips off the "cachedep-modules-" and
339 @# replaces all "_" with "/".
340 @#
341 @# e.g. cachedep-modules-internal_protocoltest
342 cd ./internal/repotools/cmd/eachmodule \
343 && go run . -p $(subst _,/,$(subst cachedep-modules-,,$@)) ${EACHMODULE_FLAGS} \
344 "go mod download"
345
346api-diff-modules-%:
347 @# Command that uses the pattern to define the root path that the
348 @# module testing will start from. Strips off the "api-diff-modules-" and
349 @# replaces all "_" with "/".
350 @#
351 @# Requires golang.org/x/exp/cmd/gorelease to be available in the GOPATH.
352 @#
353 @# e.g. api-diff-modules-internal_protocoltest
354 cd ./internal/repotools/cmd/eachmodule \
355 && go run . -p $(subst _,/,$(subst api-diff-modules-,,$@)) \
356 -fail-fast=true \
357 -c 1 \
358 -skip="internal/repotools" \
359 "$$(go env GOPATH)/bin/gorelease"
360
361##############
362# CI Testing #
363##############
364.PHONY: ci-test ci-test-no-generate ci-test-generate-validate
365
366ci-test: generate unit-race ci-test-generate-validate
367ci-test-no-generate: unit-race
368
369ci-test-generate-validate:
370 @echo "CI test validate no generated code changes"
371 git update-index --assume-unchanged go.mod go.sum
372 git add . -A
373 gitstatus=`git diff --cached --ignore-space-change`; \
374 echo "$$gitstatus"; \
375 if [ "$$gitstatus" != "" ] && [ "$$gitstatus" != "skipping validation" ]; then echo "$$gitstatus"; exit 1; fi
376 git update-index --no-assume-unchanged go.mod go.sum
377
378ci-lint: ci-lint-.
379
380ci-lint-%:
381 @# Run golangci-lint command that uses the pattern to define the root path that the
382 @# module check will start from. Strips off the "ci-lint-" and
383 @# replaces all "_" with "/".
384 @#
385 @# e.g. ci-lint-internal_protocoltest
386 cd ./internal/repotools/cmd/eachmodule \
387 && go run . -p $(subst _,/,$(subst ci-lint-,,$@)) \
388 -fail-fast=false \
389 -c 1 \
390 -skip="internal/repotools" \
391 "golangci-lint run"
392
393ci-lint-install:
394 @# Installs golangci-lint at GoPATH.
395 @# This should be used to run golangci-lint locally.
396 @#
397 go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
398
399#######################
400# Integration Testing #
401#######################
402.PHONY: integration integ-modules-% cleanup-integ-buckets
403
404integration: integ-modules-service
405
406integ-modules-%:
407 @# integration command that uses the pattern to define the root path that
408 @# the module testing will start from. Strips off the "integ-modules-" and
409 @# replaces all "_" with "/".
410 @#
411 @# e.g. test-modules-service_dynamodb
412 cd ./internal/repotools/cmd/eachmodule \
413 && go run . -p $(subst _,/,$(subst integ-modules-,,$@)) ${EACHMODULE_FLAGS} \
414 "go test -timeout=10m -tags "integration" -v ${RUN_INTEG} -count 1 ./..."
415
416cleanup-integ-buckets:
417 @echo "Cleaning up SDK integration resources"
418 go run -tags "integration" ./internal/awstesting/cmd/bucket_cleanup/main.go "aws-sdk-go-integration"
419
420##############
421# Benchmarks #
422##############
423.PHONY: bench bench-modules-%
424
425bench: bench-modules-.
426
427bench-modules-%:
428 @# benchmark command that uses the pattern to define the root path that
429 @# the module testing will start from. Strips off the "bench-modules-" and
430 @# replaces all "_" with "/".
431 @#
432 @# e.g. bench-modules-service_dynamodb
433 cd ./internal/repotools/cmd/eachmodule \
434 && go run . -p $(subst _,/,$(subst bench-modules-,,$@)) ${EACHMODULE_FLAGS} \
435 "go test -timeout=10m -bench . --benchmem ${BUILD_TAGS} ${RUN_NONE} ./..."
436
437#####################
438# Release Process #
439#####################
440.PHONY: preview-release pre-release-validation release
441
442ls-changes:
443 go run ${REPOTOOLS_CMD_CHANGELOG} ls
444
445preview-release:
446 go run ${REPOTOOLS_CMD_CALCULATE_RELEASE} ${REPOTOOLS_CALCULATE_RELEASE_VERBOSE_FLAG} ${REPOTOOLS_CALCULATE_RELEASE_ADDITIONAL_ARGS}
447
448pre-release-validation:
449 @if [[ -z "${RELEASE_MANIFEST_FILE}" ]]; then \
450 echo "RELEASE_MANIFEST_FILE is required to specify the file to write the release manifest" && false; \
451 fi
452 @if [[ -z "${RELEASE_CHGLOG_DESC_FILE}" ]]; then \
453 echo "RELEASE_CHGLOG_DESC_FILE is required to specify the file to write the release notes" && false; \
454 fi
455
456release: pre-release-validation
457 go run ${REPOTOOLS_CMD_CALCULATE_RELEASE} -o ${RELEASE_MANIFEST_FILE} ${REPOTOOLS_CALCULATE_RELEASE_VERBOSE_FLAG} ${REPOTOOLS_CALCULATE_RELEASE_ADDITIONAL_ARGS}
458 go run ${REPOTOOLS_CMD_UPDATE_REQUIRES} -release ${RELEASE_MANIFEST_FILE}
459 go run ${REPOTOOLS_CMD_UPDATE_MODULE_METADATA} -release ${RELEASE_MANIFEST_FILE}
460 go run ${REPOTOOLS_CMD_GENERATE_CHANGELOG} -release ${RELEASE_MANIFEST_FILE} -o ${RELEASE_CHGLOG_DESC_FILE}
461 go run ${REPOTOOLS_CMD_CHANGELOG} rm -all
462 go run ${REPOTOOLS_CMD_TAG_RELEASE} -release ${RELEASE_MANIFEST_FILE}
463
464##############
465# Repo Tools #
466##############
467.PHONY: install-repotools
468
469install-repotools:
470 go install ${REPOTOOLS_MODULE}/cmd/changelog@${REPOTOOLS_VERSION}
471
472set-smithy-go-version:
473 @if [[ -z "${SMITHY_GO_VERSION}" ]]; then \
474 echo "SMITHY_GO_VERSION is required to update SDK's smithy-go module dependency version" && false; \
475 fi
476 go run ${REPOTOOLS_CMD_EDIT_MODULE_DEPENDENCY} -s "github.com/aws/smithy-go" -v "${SMITHY_GO_VERSION}"
477
478##################
479# Linting/Verify #
480##################
481.PHONY: verify lint vet vet-modules-% sdkv1check
482
483verify: lint vet sdkv1check
484
485lint:
486 @echo "go lint SDK and vendor packages"
487 @lint=`golint ./...`; \
488 dolint=`echo "$$lint" | grep -E -v \
489 -e ${LINT_IGNORE_S3MANAGER_INPUT} \
490 -e ${LINTIGNORESINGLEFIGHT} \
491 -e ${LINT_IGNORE_AWSRULESFN_ARN} \
492 -e ${LINT_IGNORE_AWSRULESFN_PARTITION} \
493 -e ${LINT_IGNORE_PRIVATE_METRICS}`; \
494 echo "$$dolint"; \
495 if [ "$$dolint" != "" ]; then exit 1; fi
496
497vet: vet-modules-.
498
499vet-modules-%:
500 cd ./internal/repotools/cmd/eachmodule \
501 && go run . -p $(subst _,/,$(subst vet-modules-,,$@)) ${EACHMODULE_FLAGS} \
502 "go vet ${BUILD_TAGS} --all ./..."
503
504sdkv1check:
505 @echo "Checking for usage of AWS SDK for Go v1"
506 @sdkv1usage=`go list -test -f '''{{ if not .Standard }}{{ range $$_, $$name := .Imports }} * {{ $$.ImportPath }} -> {{ $$name }}{{ print "\n" }}{{ end }}{{ range $$_, $$name := .TestImports }} *: {{ $$.ImportPath }} -> {{ $$name }}{{ print "\n" }}{{ end }}{{ end}}''' ./... | sort -u | grep '''/aws-sdk-go/'''`; \
507 echo "$$sdkv1usage"; \
508 if [ "$$sdkv1usage" != "" ]; then exit 1; fi
509
510list-deps: list-deps-.
511
512list-deps-%:
513 @# command that uses the pattern to define the root path that the
514 @# module testing will start from. Strips off the "list-deps-" and
515 @# replaces all "_" with "/".
516 @#
517 @# Trim output to only include stdout for list of dependencies only.
518 @# make list-deps 2>&-
519 @#
520 @# e.g. list-deps-internal_protocoltest
521 @cd ./internal/repotools/cmd/eachmodule \
522 && go run . -p $(subst _,/,$(subst list-deps-,,$@)) ${EACHMODULE_FLAGS} \
523 "go list -m all | grep -v 'github.com/aws/aws-sdk-go-v2'" | sort -u
524
525###################
526# Sandbox Testing #
527###################
528.PHONY: sandbox-tests sandbox-build-% sandbox-run-% sandbox-test-% update-aws-golang-tip
529
530sandbox-tests: sandbox-test-go1.15 sandbox-test-go1.16 sandbox-test-go1.17 sandbox-test-go1.18 sandbox-test-go1.19 sandbox-test-go1.20 sandbox-test-gotip
531
532sandbox-build-%:
533 @# sandbox-build-go1.17
534 @# sandbox-build-gotip
535 @if [ $@ == sandbox-build-gotip ]; then\
536 docker build \
537 -f ./internal/awstesting/sandbox/Dockerfile.test.gotip \
538 -t "aws-sdk-go-$(subst sandbox-build-,,$@)" . ;\
539 else\
540 docker build \
541 --build-arg GO_VERSION=$(subst sandbox-build-go,,$@) \
542 -f ./internal/awstesting/sandbox/Dockerfile.test.goversion \
543 -t "aws-sdk-go-$(subst sandbox-build-,,$@)" . ;\
544 fi
545
546sandbox-run-%: sandbox-build-%
547 @# sandbox-run-go1.17
548 @# sandbox-run-gotip
549 docker run -i -t "aws-sdk-go-$(subst sandbox-run-,,$@)" bash
550sandbox-test-%: sandbox-build-%
551 @# sandbox-test-go1.17
552 @# sandbox-test-gotip
553 docker run -t "aws-sdk-go-$(subst sandbox-test-,,$@)"
554
555update-aws-golang-tip:
556 docker build --no-cache=true -f ./internal/awstesting/sandbox/Dockerfile.golang-tip -t "aws-golang:tip" .
View as plain text