naml icon indicating copy to clipboard operation
naml copied to clipboard

codify: replace valast.Addr(v).(*T) with k8s.io/utils/pointer equivalents?

Open dnwe opened this issue 4 years ago • 1 comments

👋🏻 Firstly, thank you so much for naml — it is wonderful!


It would be great if the codify-generated code could avoid the runtime dependency on valast by using the k8s.io/utils/pointer package for getting pointers to a primitive:

e.g.,

-valast.Addr(false).(*bool)
+pointer.Bool(false)
-valast.Addr(int64(65534)).(*int64)
+pointer.Int64(65534)

etc.

This also produces more readable code.

Obviously there's no built-in support in valast for customising the generated ast so it would have to be a post-processing task done in codify itself

dnwe avatar Oct 08 '21 11:10 dnwe

interested in opening a PR for this?

this change seems reasonable to me

krisnova avatar Oct 09 '21 04:10 krisnova