MCPcopy Create free account
hub / github.com/expr-lang/expr / unpackValue

Method unpackValue

internal/spew/format.go:94–102  ·  view source on GitHub ↗

unpackValue returns values inside of non-nil interfaces when possible and ensures that types for values which have been unpacked from an interface are displayed when the show types flag is also set. This is useful for data types like structs, arrays, slices, and maps which can contain varying types

(v reflect.Value)

Source from the content-addressed store, hash-verified

92// This is useful for data types like structs, arrays, slices, and maps which
93// can contain varying types packed inside an interface.
94func (f *formatState) unpackValue(v reflect.Value) reflect.Value {
95 if v.Kind() == reflect.Interface {
96 f.ignoreNextType = false
97 if !v.IsNil() {
98 v = v.Elem()
99 }
100 }
101 return v
102}
103
104// formatPtr handles formatting of pointers by indirecting them as necessary.
105func (f *formatState) formatPtr(v reflect.Value) {

Callers 1

formatMethod · 0.95

Calls 1

ElemMethod · 0.80

Tested by

no test coverage detected