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

Method UnmarshalYAML

decode_test.go:1278–1294  ·  view source on GitHub ↗
(node *yaml.Node)

Source from the content-addressed store, hash-verified

1276type sliceUnmarshaler []int
1277
1278func (su *sliceUnmarshaler) UnmarshalYAML(node *yaml.Node) error {
1279 var slice []int
1280 err := node.Decode(&slice)
1281 if err == nil {
1282 *su = slice
1283 return nil
1284 }
1285
1286 var intVal int
1287 err = node.Decode(&intVal)
1288 if err == nil {
1289 *su = []int{intVal}
1290 return nil
1291 }
1292
1293 return err
1294}
1295
1296func (s *S) TestUnmarshalerRetry(c *C) {
1297 var su sliceUnmarshaler

Callers

nothing calls this directly

Calls 1

DecodeMethod · 0.45

Tested by

no test coverage detected