|
|
@ -116,34 +116,32 @@ func (x *X) UnmarshalYAML(unmarshal func(interface{}) error) error { |
|
|
|
if err := unmarshal(&dec); err != nil { |
|
|
|
if err := unmarshal(&dec); err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
var x0 X |
|
|
|
|
|
|
|
if dec.Slice == nil { |
|
|
|
if dec.Slice == nil { |
|
|
|
return errors.New("missing required field 'slice' for X") |
|
|
|
return errors.New("missing required field 'slice' for X") |
|
|
|
} |
|
|
|
} |
|
|
|
x0.Slice = make([]int, len(dec.Slice)) |
|
|
|
x.Slice = make([]int, len(dec.Slice)) |
|
|
|
for k, v := range dec.Slice { |
|
|
|
for k, v := range dec.Slice { |
|
|
|
x0.Slice[k] = int(v) |
|
|
|
x.Slice[k] = int(v) |
|
|
|
} |
|
|
|
} |
|
|
|
if dec.Named == nil { |
|
|
|
if dec.Named == nil { |
|
|
|
return errors.New("missing required field 'named' for X") |
|
|
|
return errors.New("missing required field 'named' for X") |
|
|
|
} |
|
|
|
} |
|
|
|
x0.Named = make(namedSlice, len(dec.Named)) |
|
|
|
x.Named = make(namedSlice, len(dec.Named)) |
|
|
|
for k, v := range dec.Named { |
|
|
|
for k, v := range dec.Named { |
|
|
|
x0.Named[k] = int(v) |
|
|
|
x.Named[k] = int(v) |
|
|
|
} |
|
|
|
} |
|
|
|
if dec.ByteString == nil { |
|
|
|
if dec.ByteString == nil { |
|
|
|
return errors.New("missing required field 'byteString' for X") |
|
|
|
return errors.New("missing required field 'byteString' for X") |
|
|
|
} |
|
|
|
} |
|
|
|
x0.ByteString = string(dec.ByteString) |
|
|
|
x.ByteString = string(dec.ByteString) |
|
|
|
if dec.NoConv == nil { |
|
|
|
if dec.NoConv == nil { |
|
|
|
return errors.New("missing required field 'noConv' for X") |
|
|
|
return errors.New("missing required field 'noConv' for X") |
|
|
|
} |
|
|
|
} |
|
|
|
x0.NoConv = dec.NoConv |
|
|
|
x.NoConv = dec.NoConv |
|
|
|
if dec.NoConvNamed == nil { |
|
|
|
if dec.NoConvNamed == nil { |
|
|
|
return errors.New("missing required field 'noConvNamed' for X") |
|
|
|
return errors.New("missing required field 'noConvNamed' for X") |
|
|
|
} |
|
|
|
} |
|
|
|
x0.NoConvNamed = dec.NoConvNamed |
|
|
|
x.NoConvNamed = dec.NoConvNamed |
|
|
|
*x = x0 |
|
|
|
|
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -186,33 +184,31 @@ func (x *X) UnmarshalTOML(unmarshal func(interface{}) error) error { |
|
|
|
if err := unmarshal(&dec); err != nil { |
|
|
|
if err := unmarshal(&dec); err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
var x0 X |
|
|
|
|
|
|
|
if dec.Slice == nil { |
|
|
|
if dec.Slice == nil { |
|
|
|
return errors.New("missing required field 'slice' for X") |
|
|
|
return errors.New("missing required field 'slice' for X") |
|
|
|
} |
|
|
|
} |
|
|
|
x0.Slice = make([]int, len(dec.Slice)) |
|
|
|
x.Slice = make([]int, len(dec.Slice)) |
|
|
|
for k, v := range dec.Slice { |
|
|
|
for k, v := range dec.Slice { |
|
|
|
x0.Slice[k] = int(v) |
|
|
|
x.Slice[k] = int(v) |
|
|
|
} |
|
|
|
} |
|
|
|
if dec.Named == nil { |
|
|
|
if dec.Named == nil { |
|
|
|
return errors.New("missing required field 'named' for X") |
|
|
|
return errors.New("missing required field 'named' for X") |
|
|
|
} |
|
|
|
} |
|
|
|
x0.Named = make(namedSlice, len(dec.Named)) |
|
|
|
x.Named = make(namedSlice, len(dec.Named)) |
|
|
|
for k, v := range dec.Named { |
|
|
|
for k, v := range dec.Named { |
|
|
|
x0.Named[k] = int(v) |
|
|
|
x.Named[k] = int(v) |
|
|
|
} |
|
|
|
} |
|
|
|
if dec.ByteString == nil { |
|
|
|
if dec.ByteString == nil { |
|
|
|
return errors.New("missing required field 'byteString' for X") |
|
|
|
return errors.New("missing required field 'byteString' for X") |
|
|
|
} |
|
|
|
} |
|
|
|
x0.ByteString = string(dec.ByteString) |
|
|
|
x.ByteString = string(dec.ByteString) |
|
|
|
if dec.NoConv == nil { |
|
|
|
if dec.NoConv == nil { |
|
|
|
return errors.New("missing required field 'noConv' for X") |
|
|
|
return errors.New("missing required field 'noConv' for X") |
|
|
|
} |
|
|
|
} |
|
|
|
x0.NoConv = dec.NoConv |
|
|
|
x.NoConv = dec.NoConv |
|
|
|
if dec.NoConvNamed == nil { |
|
|
|
if dec.NoConvNamed == nil { |
|
|
|
return errors.New("missing required field 'noConvNamed' for X") |
|
|
|
return errors.New("missing required field 'noConvNamed' for X") |
|
|
|
} |
|
|
|
} |
|
|
|
x0.NoConvNamed = dec.NoConvNamed |
|
|
|
x.NoConvNamed = dec.NoConvNamed |
|
|
|
*x = x0 |
|
|
|
|
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|