From 5c15c417473a6cb36285636280efca233738f67d Mon Sep 17 00:00:00 2001 From: Jason Del Ponte Date: Fri, 7 Oct 2016 15:40:39 -0700 Subject: [PATCH 1/2] Add build tags to internal SDK tools Adds the `deprecated` build tags to the awsmigrate. Adds the `example` build tag to all examples. Adds the `codegen` build tags to the SDK's code generate commands. --- Makefile | 5 +++-- awsmigrate/awsmigrate-renamer/gen/gen.go | 2 +- awsmigrate/awsmigrate-renamer/rename/rename.go | 2 +- awsmigrate/awsmigrate-renamer/rename/renames.go | 2 +- awsmigrate/awsmigrate-renamer/renamer.go | 2 +- .../handleServiceErrorCodes/handleServiceErrorCodes.go | 2 ++ example/service/cloudfront/signCookies/signCookies.go | 2 ++ example/service/ec2/filterInstances/filter_ec2_by_tag.go | 2 ++ example/service/s3/concatObjects/concatObjects.go | 2 ++ example/service/s3/listObjects/listObjects.go | 2 ++ .../s3/listObjectsConcurrently/listObjectsConcurrently.go | 2 ++ models/protocol_tests/generate.go | 2 ++ private/model/cli/api-info/api-info.go | 2 ++ private/model/cli/gen-api/main.go | 2 ++ private/model/cli/gen-endpoints/main.go | 2 ++ 15 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index ae067d2e932..f7dff07bec4 100644 --- a/Makefile +++ b/Makefile @@ -48,14 +48,15 @@ gen-endpoints: build: @echo "go build SDK and vendor packages" @go build ${SDK_ONLY_PKGS} + @go build -tags example ./example/... unit: get-deps-tests build verify @echo "go test SDK and vendor packages" - @go test -tags $(SDK_ONLY_PKGS) + @go test $(SDK_ONLY_PKGS) unit-with-race-cover: get-deps-tests build verify @echo "go test SDK and vendor packages" - @go test -tags -race -cpu=1,2,4 $(SDK_ONLY_PKGS) + @go test -race -cpu=1,2,4 $(SDK_ONLY_PKGS) integration: get-deps-tests integ-custom smoke-tests performance diff --git a/awsmigrate/awsmigrate-renamer/gen/gen.go b/awsmigrate/awsmigrate-renamer/gen/gen.go index 0dc65294238..286d4bfd7a6 100644 --- a/awsmigrate/awsmigrate-renamer/gen/gen.go +++ b/awsmigrate/awsmigrate-renamer/gen/gen.go @@ -1,4 +1,4 @@ -// +build go1.5 +// +build go1.5,deprecated package main diff --git a/awsmigrate/awsmigrate-renamer/rename/rename.go b/awsmigrate/awsmigrate-renamer/rename/rename.go index 05d6f36265f..234ae7ce675 100644 --- a/awsmigrate/awsmigrate-renamer/rename/rename.go +++ b/awsmigrate/awsmigrate-renamer/rename/rename.go @@ -1,4 +1,4 @@ -// +build go1.5 +// +build go1.5,deprecated package rename diff --git a/awsmigrate/awsmigrate-renamer/rename/renames.go b/awsmigrate/awsmigrate-renamer/rename/renames.go index 0d22f39ec9a..55c7b4e676a 100644 --- a/awsmigrate/awsmigrate-renamer/rename/renames.go +++ b/awsmigrate/awsmigrate-renamer/rename/renames.go @@ -1,4 +1,4 @@ -// +build go1.5 +// +build go1.5,deprecated package rename diff --git a/awsmigrate/awsmigrate-renamer/renamer.go b/awsmigrate/awsmigrate-renamer/renamer.go index ed60e88dd08..df5c5e89b1f 100644 --- a/awsmigrate/awsmigrate-renamer/renamer.go +++ b/awsmigrate/awsmigrate-renamer/renamer.go @@ -1,4 +1,4 @@ -// +build go1.5 +// +build go1.5,deprecated package main diff --git a/example/aws/request/handleServiceErrorCodes/handleServiceErrorCodes.go b/example/aws/request/handleServiceErrorCodes/handleServiceErrorCodes.go index 3fc306ac97b..1e36634cb6f 100644 --- a/example/aws/request/handleServiceErrorCodes/handleServiceErrorCodes.go +++ b/example/aws/request/handleServiceErrorCodes/handleServiceErrorCodes.go @@ -1,3 +1,5 @@ +// +build example + package main import ( diff --git a/example/service/cloudfront/signCookies/signCookies.go b/example/service/cloudfront/signCookies/signCookies.go index e476869dd62..b16545aaff6 100644 --- a/example/service/cloudfront/signCookies/signCookies.go +++ b/example/service/cloudfront/signCookies/signCookies.go @@ -1,3 +1,5 @@ +// +build example + package main import ( diff --git a/example/service/ec2/filterInstances/filter_ec2_by_tag.go b/example/service/ec2/filterInstances/filter_ec2_by_tag.go index a5c3c7e9f22..c85fce607b0 100644 --- a/example/service/ec2/filterInstances/filter_ec2_by_tag.go +++ b/example/service/ec2/filterInstances/filter_ec2_by_tag.go @@ -1,3 +1,5 @@ +// +build example + package main import ( diff --git a/example/service/s3/concatObjects/concatObjects.go b/example/service/s3/concatObjects/concatObjects.go index 1ca9cca5e8b..5c598263670 100644 --- a/example/service/s3/concatObjects/concatObjects.go +++ b/example/service/s3/concatObjects/concatObjects.go @@ -1,3 +1,5 @@ +// +build example + package main import ( diff --git a/example/service/s3/listObjects/listObjects.go b/example/service/s3/listObjects/listObjects.go index 57ceb049ffb..ac37bdf1118 100644 --- a/example/service/s3/listObjects/listObjects.go +++ b/example/service/s3/listObjects/listObjects.go @@ -1,3 +1,5 @@ +// +build example + package main import ( diff --git a/example/service/s3/listObjectsConcurrently/listObjectsConcurrently.go b/example/service/s3/listObjectsConcurrently/listObjectsConcurrently.go index 2f4cdf5da4b..4e031cfaefd 100644 --- a/example/service/s3/listObjectsConcurrently/listObjectsConcurrently.go +++ b/example/service/s3/listObjectsConcurrently/listObjectsConcurrently.go @@ -1,3 +1,5 @@ +// +build example + package main import ( diff --git a/models/protocol_tests/generate.go b/models/protocol_tests/generate.go index 56630309545..18aba31024f 100644 --- a/models/protocol_tests/generate.go +++ b/models/protocol_tests/generate.go @@ -1,3 +1,5 @@ +// +build codegen + package main import ( diff --git a/private/model/cli/api-info/api-info.go b/private/model/cli/api-info/api-info.go index 44faa262eb1..ee2b66d6492 100644 --- a/private/model/cli/api-info/api-info.go +++ b/private/model/cli/api-info/api-info.go @@ -1,3 +1,5 @@ +// +build codegen + package main import ( diff --git a/private/model/cli/gen-api/main.go b/private/model/cli/gen-api/main.go index 7b2a21a0416..668ad278cd3 100644 --- a/private/model/cli/gen-api/main.go +++ b/private/model/cli/gen-api/main.go @@ -1,3 +1,5 @@ +// +build codegen + // Command aws-gen-gocli parses a JSON description of an AWS API and generates a // Go file containing a client for the API. // diff --git a/private/model/cli/gen-endpoints/main.go b/private/model/cli/gen-endpoints/main.go index 971e989a49f..d6655fcf58e 100644 --- a/private/model/cli/gen-endpoints/main.go +++ b/private/model/cli/gen-endpoints/main.go @@ -1,3 +1,5 @@ +// +build codegen + // Command aws-gen-goendpoints parses a JSON description of the AWS endpoint // discovery logic and generates a Go file which returns an endpoint. // From 2372a0b1242404c0c73bdbb3ca979a33c9fbd9fb Mon Sep 17 00:00:00 2001 From: Jason Del Ponte Date: Fri, 7 Oct 2016 16:32:44 -0700 Subject: [PATCH 2/2] example: Update example READMEs with with example tag --- example/aws/request/handleServiceErrorCodes/README.md | 2 +- example/service/cloudfront/signCookies/README.md | 2 +- example/service/cloudfront/signCookies/signCookies.go | 2 +- example/service/ec2/filterInstances/README.md | 2 +- example/service/ec2/filterInstances/filter_ec2_by_tag.go | 2 +- example/service/s3/concatObjects/README.md | 2 +- example/service/s3/listObjects/README.md | 2 +- example/service/s3/listObjects/listObjects.go | 2 +- example/service/s3/listObjectsConcurrently/README.md | 4 ++-- .../s3/listObjectsConcurrently/listObjectsConcurrently.go | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/example/aws/request/handleServiceErrorCodes/README.md b/example/aws/request/handleServiceErrorCodes/README.md index 3b38a3a93bb..afc70631afd 100644 --- a/example/aws/request/handleServiceErrorCodes/README.md +++ b/example/aws/request/handleServiceErrorCodes/README.md @@ -13,5 +13,5 @@ If the object's bucket or key does not exist a specific error message will be pr Any other error will be printed as an unknown error. ```sh -go run handleServiceErrorCodes.go mybucket mykey +go run -tags example handleServiceErrorCodes.go mybucket mykey ``` diff --git a/example/service/cloudfront/signCookies/README.md b/example/service/cloudfront/signCookies/README.md index 776f22a942f..567d22652db 100644 --- a/example/service/cloudfront/signCookies/README.md +++ b/example/service/cloudfront/signCookies/README.md @@ -6,7 +6,7 @@ This example shows how the CloudFront CookieSigner can be used to generate signe Makes a request for object using CloudFront cookie signing, and outputs the contents of the object to stdout. ```sh -go run signCookies.go -file -id -r -g +go run -tags example signCookies.go -file -id -r -g ``` diff --git a/example/service/cloudfront/signCookies/signCookies.go b/example/service/cloudfront/signCookies/signCookies.go index b16545aaff6..70bd335f159 100644 --- a/example/service/cloudfront/signCookies/signCookies.go +++ b/example/service/cloudfront/signCookies/signCookies.go @@ -16,7 +16,7 @@ import ( // the contents of the object to stdout. // // Usage example: -// go run signCookies.go -file -id -r -g +// signCookies -file -id -r -g func main() { var keyFile string // Private key PEM file var keyID string // Key pair ID of CloudFront key pair diff --git a/example/service/ec2/filterInstances/README.md b/example/service/ec2/filterInstances/README.md index fff22a0335d..a8ac0b6079c 100644 --- a/example/service/ec2/filterInstances/README.md +++ b/example/service/ec2/filterInstances/README.md @@ -8,7 +8,7 @@ filter_ec2_by_tag is an example using the AWS SDK for Go to list ec2 instaces th The example uses the the bucket name provided, and lists all object keys in a bucket. ```sh -go run filter_ec2_by_tag.go +go run -tags example filter_ec2_by_tag.go ``` Output: diff --git a/example/service/ec2/filterInstances/filter_ec2_by_tag.go b/example/service/ec2/filterInstances/filter_ec2_by_tag.go index c85fce607b0..f83e942b499 100644 --- a/example/service/ec2/filterInstances/filter_ec2_by_tag.go +++ b/example/service/ec2/filterInstances/filter_ec2_by_tag.go @@ -16,7 +16,7 @@ import ( // This example will list instances with a filter // // Usage: -// go run filter_ec2_by_tag.go +// filter_ec2_by_tag func main() { sess, err := session.NewSession() if err != nil { diff --git a/example/service/s3/concatObjects/README.md b/example/service/s3/concatObjects/README.md index 6bc8fe22227..e55e3847eed 100644 --- a/example/service/s3/concatObjects/README.md +++ b/example/service/s3/concatObjects/README.md @@ -10,5 +10,5 @@ two objects that we want to concatenate together. The example uses the the bucket name provided, two keys for each object, and lastly the output key. ```sh -AWS_REGION= go run concatenateObjects.go +AWS_REGION= go run -tags example concatenateObjects.go ``` diff --git a/example/service/s3/listObjects/README.md b/example/service/s3/listObjects/README.md index 6a5f2c9beab..fc9f6e3e467 100644 --- a/example/service/s3/listObjects/README.md +++ b/example/service/s3/listObjects/README.md @@ -8,7 +8,7 @@ listObjects is an example using the AWS SDK for Go to list objects' key in a S3 The example uses the the bucket name provided, and lists all object keys in a bucket. ```sh -go run listObjects.go +go run -tags example listObjects.go ``` Output: diff --git a/example/service/s3/listObjects/listObjects.go b/example/service/s3/listObjects/listObjects.go index ac37bdf1118..75ea4c501a3 100644 --- a/example/service/s3/listObjects/listObjects.go +++ b/example/service/s3/listObjects/listObjects.go @@ -13,7 +13,7 @@ import ( // Lists all objects in a bucket using pagination // // Usage: -// go run listObjects.go +// listObjects func main() { if len(os.Args) < 2 { fmt.Println("you must specify a bucket") diff --git a/example/service/s3/listObjectsConcurrently/README.md b/example/service/s3/listObjectsConcurrently/README.md index 5d99711df60..82e252ed278 100644 --- a/example/service/s3/listObjectsConcurrently/README.md +++ b/example/service/s3/listObjectsConcurrently/README.md @@ -1,13 +1,13 @@ ## Example -listS3EncryptedObjects is an example using the AWS SDK for Go concurrently to list the encrypted objects in the S3 buckets owned by an account. +listObjectsConcurrentlv is an example using the AWS SDK for Go concurrently to list the encrypted objects in the S3 buckets owned by an account. ## Usage The example's `accounts` string slice contains a list of the SharedCredentials profiles which will be used to look up the buckets owned by each profile. Each bucket's objects will be queried. ``` -AWS_REGION=us-east-1 go run example/listS3EncryptedObjects/main.go +AWS_REGION=us-east-1 go run -tags example listObjectsConcurrentlv.go ``` diff --git a/example/service/s3/listObjectsConcurrently/listObjectsConcurrently.go b/example/service/s3/listObjectsConcurrently/listObjectsConcurrently.go index 4e031cfaefd..d399f54a785 100644 --- a/example/service/s3/listObjectsConcurrently/listObjectsConcurrently.go +++ b/example/service/s3/listObjectsConcurrently/listObjectsConcurrently.go @@ -23,7 +23,7 @@ func exit(msg ...interface{}) { // contains a list of profiles to use. // // Usage: -// go run listObjectsConcurrently.go +// listObjectsConcurrentlv func main() { accounts := []string{"default", "default2", "otherprofile"}