goPath not worked
What happened?
crd2pulumi --goPath ./crontabs crontab.yaml generate code under package kubernetes not under crontabs
Steps to reproduce
Just like README says, prepare crontab.yaml first, then run crd2pulumi --goPath ./crontabs crontab.yaml
Expected Behavior
generated code under new package crontabs
Actual Behavior
generated code under new package kubernetes
Versions used
v1.2.0
Additional context
No response
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).
Hi @howieyuen , we have reproduced this issue and can confirm this is a bug. This bug only seems present for Go, and the equivalent flags for other languages are functional. This portion of the codebase seems to have undergone quite a lot of changes since the last release, so the issue might have already been addressed. @mattolenik would be good to confirm whether this has been addressed?
Hi @howieyuen , we have reproduced this issue and can confirm this is a bug. This bug only seems present for Go, and the equivalent flags for other languages are functional. This portion of the codebase seems to have undergone quite a lot of changes since the last release, so the issue might have already been addressed. @mattolenik would be good to confirm whether this has been addressed?
I try to fix locally, but failed 😭
I puase here pkg/codegen/golang.go:75:
func GenerateGo(pg *PackageGenerator, name string) (buffers map[string]*bytes.Buffer, err error) {
...
for path, code := range files {
newPath, _ := filepath.Rel(name, path)
and see newPath is ../kubernetes/xxx, I don't know the intension of filepath.Rel(), but after that, back to parent func at pkg/codegen/codegen.go:86:
func writeFiles(files map[string]*bytes.Buffer, outputDir string) error {
for path, code := range files {
outputFilePath := filepath.Join(outputDir, path)
...
the outputFilePath comes from filepath.Join("crontabs","../kubernetes"), and it turns out kubernetes.
Added to epic https://github.com/pulumi/home/issues/3431