Closed seaguest closed 2 years ago
The test case on the Go Playground: https://play.golang.org/p/aRqYwob8YM6
The proposed fix is not the right solution, because the problem is not about the original value but about the output of .DeepCopy()
.
Here is the correct fix:
if original.CanInterface() {
if copier, ok := original.Interface().(Interface); ok {
out := copier.DeepCopy()
cpy.Set(reflect.ValueOf(&out).Elem())
return
}
}
@dolmen
have you verified your fix? it doesn't work. the problem here is copier could be nil, thus copier.Deepcopy will panic.
it seems this author forgot the project now.
Hello,
I got an error in my case:
My fix is to add a nil check here