MCPcopy
hub / github.com/google/go-cmp / PointerOf

Function PointerOf

cmp/internal/value/pointer.go:20–24  ·  view source on GitHub ↗

PointerOf returns a Pointer from v, which must be a reflect.Ptr, reflect.Slice, or reflect.Map.

(v reflect.Value)

Source from the content-addressed store, hash-verified

18// PointerOf returns a Pointer from v, which must be a
19// reflect.Ptr, reflect.Slice, or reflect.Map.
20func PointerOf(v reflect.Value) Pointer {
21 // The proper representation of a pointer is unsafe.Pointer,
22 // which is necessary if the GC ever uses a moving collector.
23 return Pointer{unsafe.Pointer(v.Pointer()), v.Type()}
24}
25
26// IsNil reports whether the pointer is nil.
27func (p Pointer) IsNil() bool {

Callers 5

PushPairMethod · 0.92
PushMethod · 0.92
PushMethod · 0.92
PopMethod · 0.92
FormatValueMethod · 0.92

Calls 1

TypeMethod · 0.65

Tested by

no test coverage detected