[Golang] bad import package and empty shaded type #115
Labels
area/codegen
Affects quality or correctness of generated code
kind/bug
Some behavior is incorrect or out of spec
language/go
resolution/fixed
This issue was fixed
What happened?
I generate pulumi type for certmanager crd with command :
crd2pulumi --go ../../../kubeadm/cert-manager/cert-manager/1-crds.yaml
Expected Behavior
i expected that i can create a new Certificate with
NewCertificate
when i build with
pulumi up
it give mewhen i look at generated code :
it use in import
metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/meta/v1"
but my
pulumiTypes.go
is in packagev1
so
Metadata metav1.ObjectMetaPtrOutput 'pulumi:"metadata"'
same in
pulumi/crds/kubernetes/certmanager/v1/init.go
it useversion, err := kubernetes.PkgVersion()
with import"github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes"
Steps to reproduce
the certmanager's crds come from official github but it was maybe a little bit outdated. So i joined it
https://gist.github.com/RouxAntoine/b7dfb9ce327a4ad40a76ff6552c7fd5e
Output of
pulumi about
Additional context
i try some tweek in this branch https://github.com/pulumi/crd2pulumi/compare/master...RouxAntoine:crd2pulumi:feature/upgrade-dependencies-sdk-to-v4?expand=1#
and by disabling type shading in
packagegenerator.go
line 118genPackage(pg.Version, pg.Types, pg.ResourceTokens, false)
false as last parameter it well suite in import but the shaded typeObjectMetaPtrOutput
for exemple is unknown du to missing import.Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
Thanks for this tools, Best regards
The text was updated successfully, but these errors were encountered: