I've got a slice of pointers to structs (say []*A), these structs also internally have values and pointers say:
type A struct {
a int
b *B
}
type B struct {
b int
}
Using copy on a []*A seems to do a deep copy.
sliceCopy := make([]*A, len(originalSlice))
copy(sliceCopy, originalSlice)
Is this correct? Can I assume it will always do a deep copy so I can use it in prod. Couldn't find an explanation online...
Edit: how would I do a deep copy of a slice, can I use reflection?