-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 default package name #8187
Fix default package name #8187
Conversation
| name | importBasePath | rootPackageName | resulting root | resulting name | |:-------------:|:-----------------------------------------------------:|:---------------:|----------------|:---------------------------------:| | `hello-world` | ` ` | ` ` | `hello-world` | `helloworld` | | `hello-world` | `github.com/org/my-pulumi-package-aws-thing/my-thing` | ` ` | `mything` | `mything` | | `hello-world` | `github.com/org/my-pulumi-package-aws-thing/thing` | `bar` | ` ` | `bar` (and the package is flat) | | ` ` | `github.com/org/my-pulumi-package-aws-thing/thing` | `bar` | ` ` | `bar` (and the package is flat) | | `hello-world` | ` ` | `bar` | ` ` | `bar` (and the package is flat) | | ` ` | ` ` | `bar` | ` ` | `bar` (and the package is flat) |
Diff for pulumi-azuread with merge commit 98cef56 |
Diff for pulumi-random with merge commit 98cef56 |
Diff for pulumi-azuread with merge commit 72f9d34 |
Diff for pulumi-kubernetes with merge commit 98cef56 |
Diff for pulumi-random with merge commit 72f9d34 |
Diff for pulumi-gcp with merge commit 98cef56 |
Diff for pulumi-gcp with merge commit 72f9d34 |
Diff for pulumi-kubernetes with merge commit 72f9d34 |
Diff for pulumi-aws with merge commit 98cef56 |
Diff for pulumi-azure with merge commit 98cef56 |
Diff for pulumi-aws with merge commit 72f9d34 |
Diff for pulumi-azure with merge commit 72f9d34 |
Diff for pulumi-azuread with merge commit d2118f0 |
Diff for pulumi-random with merge commit d2118f0 |
Diff for pulumi-kubernetes with merge commit d2118f0 |
Diff for pulumi-gcp with merge commit d2118f0 |
Diff for pulumi-azure with merge commit d2118f0 |
Diff for pulumi-aws with merge commit d2118f0 |
Diff for pulumi-azure-native with merge commit d2118f0 |
@@ -50,8 +50,8 @@ func TestInputUsage(t *testing.T) { | |||
|
|||
func TestGoPackageName(t *testing.T) { | |||
assert.Equal(t, "aws", goPackage("aws")) | |||
assert.Equal(t, "azure", goPackage("azure-nextgen")) | |||
assert.Equal(t, "plant", goPackage("plant-provider")) | |||
assert.Equal(t, "azurenextgen", goPackage("azure-nextgen")) |
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.
Do we know what effect (if any) this change will have on azure-native and aws-native?
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.
Looks like they don't include the -native
anyway:
"go": {
"importBasePath": "github.com/pulumi/pulumi-aws-native/sdk/go/aws",
"packageImportAliases": {
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/aws-native": "aws"
}
},
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.
I believe that packageImportAliases
went unused. We defaulted to getting the name from the name
field, and we took strings.Split("aws-native", "-")[0] == "aws"
. In the new world we take path.Base("github.com/pulumi/pulumi-aws-native/sdk/go/aws") == "aws"
. This is the same as for azure.
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.
LGTM
@iwahbe I'm not sure this is going to work all the way through codegen. I just tried changing the importBasepPath in https://github.com/pulumi/pulumi/blob/master/pkg/codegen/internal/test/testdata/simple-enum-schema/schema.json#L250 to |
We assume that the last segment of |
Resulting behavior:
hello-world
hello-world
helloworld
hello-world
github.com/org/my-pulumi-package-aws-thing/my-thing
mything
mything
hello-world
github.com/org/my-pulumi-package-aws-thing/thing
bar
bar
github.com/org/my-pulumi-package-aws-thing/thing
bar
bar
hello-world
bar
bar
bar
bar
Description
Corrects the default behavior for deriving package names from the
name
,importBasePath
androotPackageName
.Fixes #8181
Checklist