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

Function makeAddressable

cmp/compare.go:664–671  ·  view source on GitHub ↗

makeAddressable returns a value that is always addressable. It returns the input verbatim if it is already addressable, otherwise it creates a new value and returns an addressable copy.

(v reflect.Value)

Source from the content-addressed store, hash-verified

662// It returns the input verbatim if it is already addressable,
663// otherwise it creates a new value and returns an addressable copy.
664func makeAddressable(v reflect.Value) reflect.Value {
665 if v.CanAddr() {
666 return v
667 }
668 vc := reflect.New(v.Type()).Elem()
669 vc.Set(v)
670 return vc
671}

Callers 2

compareStructMethod · 0.85
FormatValueMethod · 0.85

Calls 1

TypeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…