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

Method UnmarshalYAML

decode_test.go:1309–1325  ·  view source on GitHub ↗
(unmarshal func(interface{}) error)

Source from the content-addressed store, hash-verified

1307type obsoleteSliceUnmarshaler []int
1308
1309func (su *obsoleteSliceUnmarshaler) UnmarshalYAML(unmarshal func(interface{}) error) error {
1310 var slice []int
1311 err := unmarshal(&slice)
1312 if err == nil {
1313 *su = slice
1314 return nil
1315 }
1316
1317 var intVal int
1318 err = unmarshal(&intVal)
1319 if err == nil {
1320 *su = []int{intVal}
1321 return nil
1322 }
1323
1324 return err
1325}
1326
1327func (s *S) TestObsoleteUnmarshalerRetry(c *C) {
1328 var su obsoleteSliceUnmarshaler

Callers

nothing calls this directly

Calls 1

unmarshalFunction · 0.85

Tested by

no test coverage detected