New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[sdk/go] Simplify Apply
method options to reduce binary size
#6607
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM. I'm going to avoid hitting 'approve' for now to make it harder to accidentally merge into master.
bc1e73a
to
9668cd2
Compare
4eb61e0
to
85c05e4
Compare
@lukehoban I've rebased this for you based on the new feature-3.0 branch - this is a simpler merge now :D |
LGTM. Flaky tests in CI? Something shows as red. |
@t0yv0 yeah this is because of the new minVersionChecking that is breaking our CI tests |
6050cbe
to
72bf1b0
Compare
Reduces size for simple Kuberntes Go app from 131MB to 37.5MB - a 71% size reduction. Code that used `o.ApplyString(func(...)...)` must use `o.ApplyT(func(...)...).(StringOutput)` instead.
85c05e4
to
7035c97
Compare
Co-authored-by: Komal <komal@pulumi.com>
Co-authored-by: Komal <komal@pulumi.com>
Co-authored-by: Komal <komal@pulumi.com>
Co-authored-by: Komal <komal@pulumi.com>
Co-authored-by: Komal <komal@pulumi.com>
Co-authored-by: Komal <komal@pulumi.com>
Co-authored-by: Komal <komal@pulumi.com>
[Note: This PR is intended to be delivered as part of 3.0, and will be moved to target the
feature-3.0
branch once that branch is up to date with master.]Make three breaking changes to the Pulumi Go SDK to (a) dramatically reduce the size and build-time for Pulumi Go programs and (b) simplify the options for
Apply
in Go to offer a more consistent programming model.o.Apply<TypeName>(...)
methods => useo.ApplyT(...)
insteado.Apply(...)
methods => useo.ApplyT(...)
insteado.IsSecret()
method => usepulumi.IsSecret(o)
insteadFor a common Go program (the Pulumi Kubernetes Go template for example), this reduces binary size by 77% (from 131.2MB to 30.7MB).
These changes also reduce the options for
Apply
in Pulumi's Go SDK from 3 options to just 1. Users will always useApplyT
, and can express the type of the output they get from theApplyT
call as a type assertion. This was the most commonly used style in existing codebases, and is not the single standardized option. BothApply
andApply<TypeName>
were previously thin sugar overApplyT
- but that sugar led to confusion in the programming model, and significant unintended size increases.Fixes #6592.
Resolves #6356 (no longer necessary).
Resolves #6591 (addresses most sources of large binary size).