-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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] Honor import aliases for external types/resources #8833
Conversation
Diff for pulumi-azuread with merge commit dad9a2a |
Diff for pulumi-random with merge commit dad9a2a |
Diff for pulumi-random with merge commit d87c3db |
Diff for pulumi-kubernetes with merge commit dad9a2a |
Diff for pulumi-azuread with merge commit d87c3db |
Diff for pulumi-kubernetes with merge commit d87c3db |
Diff for pulumi-gcp with merge commit dad9a2a |
Diff for pulumi-gcp with merge commit d87c3db |
Diff for pulumi-azure with merge commit dad9a2a |
Diff for pulumi-azure with merge commit d87c3db |
Diff for pulumi-aws with merge commit d87c3db |
Diff for pulumi-aws with merge commit dad9a2a |
Codecov Report
@@ Coverage Diff @@
## master #8833 +/- ##
=======================================
Coverage 59.35% 59.36%
=======================================
Files 642 642
Lines 99555 99550 -5
Branches 1389 1389
=======================================
+ Hits 59093 59094 +1
+ Misses 37090 37077 -13
- Partials 3372 3379 +7
Continue to review full report at Codecov.
|
Oops, I forgot to add the new generated test file for the other languages. Will add in the morning. |
1bb0ce2
to
5da94e7
Compare
Diff for pulumi-azuread with merge commit 55527c2 |
Diff for pulumi-random with merge commit 55527c2 |
Diff for pulumi-kubernetes with merge commit 55527c2 |
Diff for pulumi-gcp with merge commit 55527c2 |
Diff for pulumi-azure with merge commit 55527c2 |
Diff for pulumi-aws with merge commit 55527c2 |
Diff for pulumi-azure-native with merge commit 55527c2 |
Diff for pulumi-azuread with merge commit beffbf4 |
Diff for pulumi-random with merge commit beffbf4 |
Diff for pulumi-kubernetes with merge commit beffbf4 |
Diff for pulumi-gcp with merge commit beffbf4 |
Diff for pulumi-azure with merge commit beffbf4 |
Diff for pulumi-aws with merge commit beffbf4 |
Diff for pulumi-random with merge commit d7169e7 |
Diff for pulumi-azuread with merge commit d7169e7 |
Diff for pulumi-kubernetes with merge commit d7169e7 |
Diff for pulumi-gcp with merge commit d7169e7 |
Diff for pulumi-azure with merge commit d7169e7 |
Diff for pulumi-aws with merge commit d7169e7 |
Diff for pulumi-azure-native with merge commit d7169e7 |
745b0d2
to
8f4b3d6
Compare
Diff for pulumi-random with merge commit 8add2eb |
Diff for pulumi-azuread with merge commit 8add2eb |
Diff for pulumi-kubernetes with merge commit 8add2eb |
Diff for pulumi-gcp with merge commit 8add2eb |
Diff for pulumi-azure with merge commit 8add2eb |
Diff for pulumi-aws with merge commit 8add2eb |
Diff for pulumi-azure-native with merge commit 8add2eb |
This change fixes the Go SDK codegen to honor package import aliases when referencing external types/resources. Local aliases are preferred, otherwise, if the external package has an import alias, it is used. Co-authored-by: James Nugent <[email protected]> Co-authored-by: Alex Suttmiller <[email protected]>
8f4b3d6
to
468da42
Compare
Diff for pulumi-random with merge commit b4af013 |
Diff for pulumi-azuread with merge commit b4af013 |
Diff for pulumi-kubernetes with merge commit b4af013 |
Diff for pulumi-gcp with merge commit b4af013 |
Diff for pulumi-azure with merge commit b4af013 |
Diff for pulumi-aws with merge commit b4af013 |
Diff for pulumi-azure-native with merge commit b4af013 |
Problem Summary
Referencing external types/resources from Google Native doesn't work correctly in Go. For example, referencing the
AuditConfig
type leads to:Note the import at the top is
iam
but the usage is incorrectlyiamv1
. Attempting to workaround with a local import alias doesn't help.This is happening because Google Native defines its own package import aliases, but they aren't taken into account fully when emitting references to the external types/resources. And any locally defined import aliases are also not taken into account.
Fix (this change)
This change fixes the Go SDK codegen to honor package import aliases when referencing external types/resources. Local aliases are preferred, otherwise, if the external package has an import alias, it is used.