Decode decodes the node and stores its data into the value pointed to by v. See the documentation for Unmarshal for details about the conversion of YAML into a Go value.
(v interface{})
| 140 | // See the documentation for Unmarshal for details about the |
| 141 | // conversion of YAML into a Go value. |
| 142 | func (n *Node) Decode(v interface{}) (err error) { |
| 143 | d := newDecoder() |
| 144 | defer handleErr(&err) |
| 145 | out := reflect.ValueOf(v) |
| 146 | if out.Kind() == reflect.Ptr && !out.IsNil() { |
| 147 | out = out.Elem() |
| 148 | } |
| 149 | d.unmarshal(n, out) |
| 150 | if len(d.terrors) > 0 { |
| 151 | return &TypeError{d.terrors} |
| 152 | } |
| 153 | return nil |
| 154 | } |
| 155 | |
| 156 | func unmarshal(in []byte, out interface{}, strict bool) (err error) { |
| 157 | defer handleErr(&err) |