Skip to content

Conversation

@cristiGuranIonos
Copy link

@cristiGuranIonos cristiGuranIonos commented Apr 28, 2025

Description of your changes

Float64 pointer fields are not generated correctly using the latest version of corssplane-tools:
Example:

 mg.Spec.ForProvider.Lan = ptr.ToFloatPtrValue(rsp.ResolvedValue)

Where the import is :

ptr "k8s.io/utils/ptr"

Fixes #

I have:

  • Read and followed Crossplane's [contribution process].
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

Replace in go.mod for provider-upjet-ionoscloud with the local copy with the changes. Test that the code is generated correctly.

go mod vendor
make generate
make run

Ran tests in resolvers_test.go . These tests were failing before I made any changes:

		          		rsp, err = r.Resolve(ctx, reference.ResolutionRequest{
        - 			CurrentValue: convert.FromPtrValue(mg.Spec.ForProvider.CustomConfiguration),
        + 			CurrentValue: mg.Spec.ForProvider.CustomConfiguration,
          			Extract:      Configuration(),
          			Reference:    mg.Spec.ForProvider.CustomConfigurationRef,
          	... // 7 identical lines
          			return errors.Wrap(err, "mg.Spec.ForProvider.CustomConfiguration")
          		}
        - 		mg.Spec.ForProvider.CustomConfiguration = convert.ToPtrValue(rsp.ResolvedValue)
        + 		mg.Spec.ForProvider.CustomConfiguration = rsp.ResolvedValue
          		mg.Spec.ForProvider.CustomConfigurationRef = rsp.ResolvedReference

I fixed those errors, but maybe someone can take a closer look at that field.

Note: There is another solution to use convert path for both IsPointer and IsFloatPointer, but I saw that convert.FromPtrValue in convert.go is deprecated in favor of ptr.Deref.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant