Skip to content

Instantly share code, notes, and snippets.

@m0un10
Last active May 28, 2019 02:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save m0un10/5b7281203f708d1d5011615d460e916c to your computer and use it in GitHub Desktop.

How to fix breaking change in the AWS developer preview SDK for Go on the client side

A recent commit resulted in a change in naming convention for the client struct. The below is tested on Mac OS X, not sure if it needs adjustment for linux distros or not. This is not an exhaustive fix, it just fixes the APIs that I was using in my projects.

find . -type f -name "*.go" | xargs sed -i '' 's/s3\.S3/s3.Client/g'
find . -type f -name "*.go" | xargs sed -i '' 's/cloudfront\.CloudFront/cloudfront.Client/g'
find . -type f -name "*.go" | xargs sed -i '' 's/dynamodb\.DynamoDB/dynamodb.Client/g'
find . -type f -name "*.go" | xargs sed -i '' 's/ecs\.ECS/ecs.Client/g'
find . -type f -name "*.go" | xargs sed -i '' 's/ec2\.EC2/ec2.Client/g'
find . -type f -name "*.go" | xargs sed -i '' 's/route53\.Route53/route53.Client/g'
find . -type f -name "*.go" | xargs sed -i '' 's/lambda\.Lambda/lambda.Client/g'
find . -type f -name "*.go" | xargs sed -i '' 's/cloudformation\.CloudFormation/cloudformation.Client/g'
find . -type f -name "*.go" | xargs sed -i '' 's/autoscaling\.AutoScaling$/autoscaling.Client/g'
find . -type f -name "*.go" | xargs sed -i '' 's/autoscaling\.Group/autoscaling.AutoScalingGroup/g'
find . -type f -name "*.go" | xargs sed -i '' 's/ecs\.ListServicesOutput/ecs.ListServicesResponse/g'
find . -type f -name "*.go" | xargs sed -i '' 's/autoscaling\.DescribeAutoScalingGroupsOutput/autoscaling.DescribeAutoScalingGroupsResponse/g'
find . -type f -name "*.go" | xargs sed -i '' 's/cloudfront\.ListDistributionsOutput/cloudfront.ListDistributionsResponse/g'

Or, simply just run the following to execute the above code directly

curl https://gist.githubusercontent.com/craigbarrau/5b7281203f708d1d5011615d460e916c/raw/client-upgrade-for-aws-go-sdk-v2.md | awk '/```/{f=0} f; /```bash/{f=1}' | bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment