code-generator
code-generator copied to clipboard
generated `With<MemberName> func implies shallow copy
We would like to use struct types generated by protoc as .Spec field in CRD.
The problem is that protobuf messages are not copyable while applyconfiguration-gen generates code that implies shallow copy.
This code: https://github.com/kubernetes/code-generator/blob/a8a213c9be7b5d38a6b76abea283eecb9f4784c2/cmd/applyconfiguration-gen/generators/applyconfiguration.go#L244
generates:
func (b *CacheApplyConfiguration) WithSpec(value v1alpha1.CacheSpec) *CacheApplyConfiguration {
b.Spec = &value
return b
}
it would be great to have something like:
func (b *CacheApplyConfiguration) WithSpec(value *v1alpha1.CacheSpec) *CacheApplyConfiguration {
b.Spec = value
return b
}