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
[codegen/go] Fix ElementType for nested collection types. #8535
Conversation
Diff for pulumi-random with merge commit e25aefe |
Diff for pulumi-azuread with merge commit e25aefe |
Diff for pulumi-kubernetes with merge commit e25aefe |
2506f52
to
684ea2e
Compare
Diff for pulumi-gcp with merge commit e25aefe |
Diff for pulumi-random with merge commit 365940a |
Diff for pulumi-azuread with merge commit 365940a |
Diff for pulumi-kubernetes with merge commit 365940a |
Diff for pulumi-azure with merge commit e25aefe |
Diff for pulumi-gcp with merge commit 365940a |
Diff for pulumi-aws with merge commit e25aefe |
Diff for pulumi-azure with merge commit 365940a |
Diff for pulumi-aws with merge commit 365940a |
Codecov Report
@@ Coverage Diff @@
## master #8535 +/- ##
==========================================
+ Coverage 58.63% 58.64% +0.01%
==========================================
Files 634 634
Lines 96865 96872 +7
Branches 1378 1378
==========================================
+ Hits 56794 56808 +14
+ Misses 36808 36798 -10
- Partials 3263 3266 +3
Continue to review full report at Codecov.
|
Diff for pulumi-azure-native with merge commit e25aefe |
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.
Can you explain to my why this isn't a breaking change? Otherwise this looks good.
Diff for pulumi-azure-native with merge commit 365940a |
Strictly speaking, this is a breaking change. In particular, it will break code that does an |
(and because this is a break that is making previously unusable types usable, I think we should take it) |
Diff for pulumi-random with merge commit 86bd894 |
Diff for pulumi-azuread with merge commit 86bd894 |
Diff for pulumi-kubernetes with merge commit 86bd894 |
Diff for pulumi-gcp with merge commit 86bd894 |
Diff for pulumi-azure with merge commit 86bd894 |
Diff for pulumi-aws with merge commit 86bd894 |
Diff for pulumi-azure-native with merge commit 86bd894 |
The element types for nested collection types are currently incorrect. For arrays, we generate an element type of `[]FooArgs`, where `FooArgs` is an args type for `FooInput`. Instead, the element type should be `[]Foo`, where `Foo` is the element type of `FooInput`. For maps, we generate an element type of `FooArgs`. Instead, the element type should be `map[string]Foo`, where `Foo` is the element type of `FooInput`. These changes correct the element types.
bfb2cab
to
96ca85c
Compare
Diff for pulumi-azuread with merge commit 59c7d49 |
Diff for pulumi-gcp with merge commit 59c7d49 |
Diff for pulumi-random with merge commit 59c7d49 |
Diff for pulumi-kubernetes with merge commit 59c7d49 |
Diff for pulumi-azure with merge commit 59c7d49 |
Diff for pulumi-aws with merge commit 59c7d49 |
Diff for pulumi-azure-native with merge commit 59c7d49 |
Is there an issue tracking the bug this fixes? I'm curious to see concretely the code that doesn't work |
There is not. This is something I came across while working on #7943. |
@lukehoban this is an example of some code that does not work: https://gist.github.com/pgavlin/bfcc0ba03e8a2b2e7dece4cdbb9c1b1c The
|
In contrast, the version with correct element types does not panic: https://gist.github.com/pgavlin/2511d0e4cadf1232cfd44682bd5589ae |
The element types for nested collection types are currently incorrect.
For arrays, we generate an element type of
[]FooArgs
, whereFooArgs
is an args type forFooInput
. Instead, the element typeshould be
[]Foo
, whereFoo
is the element type ofFooInput
.For maps, we generate an element type of
FooArgs
. Instead, the elementtype should be
map[string]Foo
, whereFoo
is the element type ofFooInput
.These changes correct the element types. This is prep for #7943.