MCPcopy
hub / github.com/go-yaml/yaml / unmarshal

Function unmarshal

yaml.go:156–173  ·  view source on GitHub ↗
(in []byte, out interface{}, strict bool)

Source from the content-addressed store, hash-verified

154}
155
156func unmarshal(in []byte, out interface{}, strict bool) (err error) {
157 defer handleErr(&err)
158 d := newDecoder()
159 p := newParser(in)
160 defer p.destroy()
161 node := p.parse()
162 if node != nil {
163 v := reflect.ValueOf(out)
164 if v.Kind() == reflect.Ptr && !v.IsNil() {
165 v = v.Elem()
166 }
167 d.unmarshal(node, v)
168 }
169 if len(d.terrors) > 0 {
170 return &TypeError{d.terrors}
171 }
172 return nil
173}
174
175// Marshal serializes the value provided into a YAML document. The structure
176// of the generated document will reflect the structure of the value itself.

Callers 4

UnmarshalYAMLMethod · 0.85
UnmarshalYAMLMethod · 0.85
UnmarshalYAMLMethod · 0.85
UnmarshalFunction · 0.85

Calls 6

handleErrFunction · 0.85
newDecoderFunction · 0.85
newParserFunction · 0.85
parseMethod · 0.80
unmarshalMethod · 0.80
destroyMethod · 0.45

Tested by 3

UnmarshalYAMLMethod · 0.68
UnmarshalYAMLMethod · 0.68
UnmarshalYAMLMethod · 0.68