crossplane / upjet

A code generation framework and runtime for Crossplane providers
Apache License 2.0
320 stars 90 forks source link

Question: Code generation results differ/Upgrade go imports #404

Closed b509 closed 1 month ago

b509 commented 6 months ago

What happened?

Upjet generates different results for me than for another maintainer or the official pipeline https://github.com/crossplane-contrib/provider-keycloak/blob/main/.github/workflows/ci.yml

Differences seem to be in quotes (mine: one double quote, pipeline: two single quotes), linebreaks and empty lines. You can see some examples here https://github.com/denniskniep/provider-keycloak/commit/ca7b2f2dace6604cfb531a873dba1bd325174f97 https://github.com/denniskniep/provider-keycloak/commit/16990cb32a1420dec4321b7ebdc7dbdf1bc87293

How can we reproduce it?

My assumption is that I had installed the newest go version (1.22) but the pipeline is using v1.21 and I had probably installed the imports using v1.22. Can anyone support in why this is happening?

mbbush commented 4 months ago

I ran into this issue a while back in provider-upjet-aws, where depending on the golang version, upjet would sometimes transform double `` into a "smart quote" like in your example. I don't remember whether it's the new version or the old one that's doing the transformation. I tried tracking it down, and the closest I got was a recent change in some go documentation tool handling the parsing of quotation marks inside comments. It didn't seem like it was obviously applicable to what I was seeing, but it was the only semi-related thing I could find.

Ultimately, the double `` in the terraform-provider-aws docs, which was causing the diff based on go version, was a bug, so I just posted a PR to remove it upstream.