goderive
goderive copied to clipboard
Create plugin for DeepCoyp for nested ptr recursion, that can copy cycles
type A struct {
B *B
}
type B struct {
A *A
}
func (a *A) Clone() *A {
a1 := &A{B: &B{}}
a1.B.A = a1
tp := &A{}
deriveDeepCopyA(tp, a1)
return tp
}
Yes good catch. Currently it is expected the deriveDeepCopy does not get looped structures, but I am open to ideas to address this and make the function more robust.
How do you propose to fix this, as in what do you propose the generated deriveDeepCopyA
's code should look like?
Yes good catch. Currently it is expected the deriveDeepCopy does not get looped structures, but I am open to ideas to address this and make the function more robust.
How do you propose to fix this, as in what do you propose the generated
deriveDeepCopyA
's code should look like?
I found this: https://github.com/huandu/go-clone/blob/master/clone.go ----> Slowly()
Fair, yes we could made a slowly version of deepcopy. Would you be interested in contributing the new plugin?
Fair, yes we could made a slowly version of deepcopy. Would you be interested in contributing the new plugin?
Let me try