Skip to content

Duplicate declarations in generated Go package #104

@Amit-Biderman

Description

@Amit-Biderman

What happened?

Hello, I have a problem with crd2pulumi -
I have generated from the following crd - https://github.com/argoproj/argo-rollouts/blob/master/manifests/crds/rollout-crd.yaml - a pulumi package using the above command, and I got errors in the pulumiTypes.go file!
When I am running pulumi up, I get the following error message:

argoRollout/argoproj/v1alpha1/pulumiTypes.go:1842:6: RolloutSpecStrategyBluegreenPostpromotionanalysisArgs redeclared in this block argoRollout/argoproj/v1alpha1/pulumiTypes.go:1674:6: other declaration of RolloutSpecStrategyBluegreenPostpromotionanalysisArgs argoRollout/argoproj/v1alpha1/pulumiTypes.go:1917:98: v.Name undefined (type RolloutSpecStrategyBluegreenPostpromotionanalysisArgs has no field or method Name) argoRollout/argoproj/v1alpha1/pulumiTypes.go:1921:99: v.Value undefined (type RolloutSpecStrategyBluegreenPostpromotionanalysisArgs has no field or method Value) argoRollout/argoproj/v1alpha1/pulumiTypes.go:1926:12: v.ValueFrom undefined (type RolloutSpecStrategyBluegreenPostpromotionanalysisArgs has no field or method ValueFrom) argoRollout/argoproj/v1alpha1/pulumiTypes.go:2719:6: RolloutSpecStrategyBluegreenPrepromotionanalysisArgs redeclared in this block argoRollout/argoproj/v1alpha1/pulumiTypes.go:2551:6: other declaration of RolloutSpecStrategyBluegreenPrepromotionanalysisArgs argoRollout/argoproj/v1alpha1/pulumiTypes.go:2794:97: v.Name undefined (type RolloutSpecStrategyBluegreenPrepromotionanalysisArgs has no field or method Name) argoRollout/argoproj/v1alpha1/pulumiTypes.go:2798:98: v.Value undefined (type RolloutSpecStrategyBluegreenPrepromotionanalysisArgs has no field or method Value) argoRollout/argoproj/v1alpha1/pulumiTypes.go:4104:6: RolloutSpecStrategyCanaryAnalysisArgs redeclared in this block argoRollout/argoproj/v1alpha1/pulumiTypes.go:3926:6: other declaration of RolloutSpecStrategyCanaryAnalysisArgs argoRollout/argoproj/v1alpha1/pulumiTypes.go:5841:6: RolloutSpecStrategyCanaryStepsAnalysisArgs redeclared in this block argoRollout/argoproj/v1alpha1/pulumiTypes.go:5673:6: other declaration of RolloutSpecStrategyCanaryStepsAnalysisArgs argoRollout/argoproj/v1alpha1/pulumiTypes.go:6813:6: RolloutSpecStrategyCanaryStepsExperimentAnalysesArgs redeclared in this block argoRollout/argoproj/v1alpha1/pulumiTypes.go:6712:6: other declaration of RolloutSpecStrategyCanaryStepsExperimentAnalysesArgs argoRollout/argoproj/v1alpha1/pulumiTypes.go:2798:98: too many errors

I am taking from this that the crd2pulumi couldn’t create the package from the crd correctly.

Steps to reproduce

  1. Download the following crd - https://github.com/argoproj/argo-helm/blob/main/charts/argo-rollouts/templates/crds/rollout-crd.yaml
  2. Run the command: crd2pulumi --goName argoRollout --goPath ./argoRollout ./rollout-crd.yaml
  3. The generated package contains error in the pulumiTypes.go

Expected Behavior

The files generated are without duplicated declarations (specifically the pulumiTypes.go)

Actual Behavior

The files generated are with duplicated declarations (specifically the pulumiTypes.go)

Output of pulumi about

CLI
Version 3.37.2
Go Version go1.18.4
Go Compiler gc

Plugins
NAME VERSION
aws 5.13.0
gcp 6.34.0
go unknown
kubernetes 3.20.4
random 4.8.1

Host
OS darwin
Version 12.1
Arch arm64

This project is written in go: executable='/usr/local/go/bin/go' version='1.18.5 darwin/amd64'

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).

Metadata

Metadata

Assignees

Labels

area/codegenAffects quality or correctness of generated codearea/schemaRelated to support for CRD or Pulumi schema supportkind/bugSome behavior is incorrect or out of specresolution/fixedThis issue was fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions