DeepCopy makes deep copies of things: unexported field values are not copied.
cpy := deepcopy.Copy(orig)
The following struct tags is supported:
type A struct {
Field1 SomeType `deepcopy:"-"` // skip, will have zero-value in copy
Field2 *SomeType `deepcopy:"="` // treat like with "=" assignment operator
}
Specifically the =
tag is usable when you want to copy a struct containing
something like *sync.Mutex
or *os.File
and don't want it to be deeply copied
but simply assigned.