Skip to content
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

Fix generated Go import paths #3335

Merged
merged 4 commits into from
Jun 7, 2024
Merged

Fix generated Go import paths #3335

merged 4 commits into from
Jun 7, 2024

Conversation

danielrbradley
Copy link
Member

@danielrbradley danielrbradley commented Jun 6, 2024

Fixes #3308

  • Set importPathPattern so convert can create module names accurately.
  • Fix golangImportAliases so they don't have v2 in twice.
  • Update Pulumi dependencies & regenerate docs schema.

This updates the paths in all go examples. Exploded schema diff:
image

Each file has the following example change:

-  "github.com/pulumi/pulumi-azure-native-sdk/azurestackhci/v2"
+  azurestackhci "github.com/pulumi/pulumi-azure-native-sdk/azurestackhci/v2"

This also related to #2990 though appears it doesn't solve all formatting yet.

- Set `importPathPattern` so convert can create module names accurately.
- Fix `golangImportAliases` so they don't have `v2` in twice.
@danielrbradley danielrbradley self-assigned this Jun 6, 2024
Copy link
Contributor

@thomas11 thomas11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-  "github.com/pulumi/pulumi-azure-native-sdk/azurestackhci/v2"
+  azurestackhci "github.com/pulumi/pulumi-azure-native-sdk/azurestackhci/v2"

Why is this an improvement? Using the first form, Go will handle the /v2 and you can just use azurestackhci.Foo.

@danielrbradley
Copy link
Member Author

danielrbradley commented Jun 6, 2024

Why is this an improvement? Using the first form, Go will handle the /v2 and you can just use azurestackhci.Foo.

I think this change is inconsequential, but adding the metadata to the schema allows pulumi convert to function correctly. @Zaid-Ajaj is that correct?

What this change does show is that the aliases do now match up to what we actually contain in the Go code.

Copy link

github-actions bot commented Jun 6, 2024

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@Zaid-Ajaj
Copy link
Contributor

I think this change is inconsequential, but adding the metadata to the schema allows pulumi convert to function correctly. @Zaid-Ajaj is that correct?

That's right, I think we now get the an alias because it actually hit one of keys in packageImportAliases which might be redundant in this case but that what we want to happen when we generate the programs

@danielrbradley danielrbradley enabled auto-merge (squash) June 7, 2024 12:23
Copy link

codecov bot commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Project coverage is 56.82%. Comparing base (6d3dce1) to head (0485932).

Files Patch % Lines
provider/pkg/gen/schema.go 71.42% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3335      +/-   ##
==========================================
- Coverage   56.84%   56.82%   -0.02%     
==========================================
  Files          66       66              
  Lines        8076     8082       +6     
==========================================
+ Hits         4591     4593       +2     
- Misses       3052     3054       +2     
- Partials      433      435       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@danielrbradley danielrbradley merged commit 3abf63c into master Jun 7, 2024
23 checks passed
@danielrbradley danielrbradley deleted the 3308-fix-go-paths branch June 7, 2024 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pulumi convert emits incorrect import paths in generated Go programs due to azure-native v2 module structure
3 participants