-
Documentation
Describe the bugI've migrated my cli app from aws-sdk-go to aws-sdk-go-v2 and binary size exploded from 27Mb to 66Mb. That built into 33Mb. Using google/bloaty, the top line is github.com/aws/aws-sdk-go-v2/service/ec2 at 11.9Mi If I call ec2test() directly the binary is 9Mb and github.com/aws/aws-sdk-go-v2/service/ec2 is 7.38Ki Expected behaviorThe binary size remains small i.e. 9Mb in cobratest mentioned above. Similar to aws-sdk-go aka v1. Current behaviorcobratest binary size is 33Mb Steps to Reproducesee https://github.com/hrez/cobratest repo Possible SolutionNo response AWS Go SDK version usedgithub.com/aws/aws-sdk-go-v2 v1.11.2 Compiler and Version usedgo version go1.17.4 linux/amd64 Operating System and versionUbuntu 18.04.6 LTS |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
There is a number of conflating factors here that need to be teased apart to understand the behavior you are seeing.
In short what you've encountered is a behavior in the Go compiler around linking, and not an issue directly with the size of the SDK itself. |
Beta Was this translation helpful? Give feedback.
-
Thanks for those details. I tried eliminating one place which used an interface but that didn't lead to any size reduction. |
Beta Was this translation helpful? Give feedback.
-
@hrez, |
Beta Was this translation helpful? Give feedback.
-
We are actually very curious to hear from others about this. In our case a 40MB increase could cause our lambdas to no longer be accepted since our zips would be over the 50MB hard limit. Are there some typical size differences that the SDK team would be able to share between using v1 and v2, and for larger project that import both v1 and v2? |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
There is a number of conflating factors here that need to be teased apart to understand the behavior you are seeing.
ec2.Client
type requires proof that the type is not used directly, is not reachable as an interface type, or that the reflection package'sMethod
orMethodByName
methods are not used which could potentially invoke the methods at runtime.