crossplane-contrib / terraform-provider-gen

Apache License 2.0
13 stars 3 forks source link

decode.go generation does not work for slice types #11

Closed kasey closed 3 years ago

kasey commented 3 years ago
go generate ./...
angryjet: error: error loading packages using pattern ./...: /Users/kasey/src/crossplane-contrib/provider-terraform-vsphere/generated/resources/host_port_group/v1alpha1/decode.go:165:20: cannot range over p (variable of type *[]Ports)
exit status 1
generated/generate.go:29: running "go": exit status 1

This was one of the cases marked as a TODO from the version of the generator demo'd at community day. The current state of this particular case is basically copy/paste from encode, so this task entails reversing the logic.

kasey commented 3 years ago

After fixing this and trying to generate a few other types, I saw that a similar leftover bug exists for "singleton" collection types -- in some places terraform uses single item lists/sets to represent singletons. I'm not going to open a separate bug for this because I think I've already fixed it and it's sort of similar, although in a different part of the code.