MCPcopy Create free account
hub / github.com/XmirrorSecurity/OpenSCA-cli / indirect

Function indirect

opensca/sca/java/xml/marshal.go:816–824  ·  view source on GitHub ↗

indirect drills into interfaces and pointers, returning the pointed-at value. If it encounters a nil interface or pointer, indirect returns that nil value. This can turn into an infinite loop given a cyclic chain, but it matches the Go 1 behavior.

(vf reflect.Value)

Source from the content-addressed store, hash-verified

814// This can turn into an infinite loop given a cyclic chain,
815// but it matches the Go 1 behavior.
816func indirect(vf reflect.Value) reflect.Value {
817 for vf.Kind() == reflect.Interface || vf.Kind() == reflect.Pointer {
818 if vf.IsNil() {
819 return vf
820 }
821 vf = vf.Elem()
822 }
823 return vf
824}
825
826func (p *printer) marshalStruct(tinfo *typeInfo, val reflect.Value) error {
827 s := parentStack{p: p}

Callers 1

marshalStructMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected