Documentation
¶
Overview ¶
Package reflectclone holds the deep-copy policy shared by the root and transform packages.
Index ¶
Constants ¶
const MaxDepth = 64
MaxDepth bounds recursion so a cyclic or pathologically nested value fails with an error instead of exhausting the stack.
Variables ¶
var ErrDepthExceeded = errors.New("copy depth exceeded")
ErrDepthExceeded reports a value nested deeper than MaxDepth, or a cycle.
var ErrUnsupportedType = errors.New("unsupported type")
ErrUnsupportedType reports a type that cannot be snapshotted safely.
Functions ¶
func Clone ¶
Clone returns a deep copy of v, detached from the caller's storage.
In strict mode, types that cannot be snapshotted safely (interface, func, chan, unsafe pointer) return ErrUnsupportedType instead of being shared. Schemas use strict mode for fallback values, which are stored and reused across calls and must not alias anything the caller can still mutate.
func ImmutableType ¶
ImmutableType reports whether values of t can be shared between copies instead of being duplicated.
func IsZero ¶
IsZero reports whether v holds its type's zero value.
reflect.Value.IsZero and time.Time.IsZero disagree for a zero instant that carries a non-nil Location: the former compares struct fields and sees a non-nil pointer, the latter does not. Shape treats "zero instant" as zero everywhere, so time.Time is special-cased.
Types ¶
This section is empty.