hugolib: Remove the now superflous Source struct

See #5324
This commit is contained in:
Bjørn Erik Pedersen 2018-10-20 19:09:03 +02:00
parent eb038cfa0a
commit 7930d2132a
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
7 changed files with 35 additions and 85 deletions

View file

@ -59,7 +59,7 @@ func unmarshal(data []byte, f Format, v interface{}) error {
case ORG:
vv, err := goorgeous.OrgHeaders(data)
if err != nil {
return err
return errors.Wrap(err, "failed to unmarshal ORG headers")
}
switch v.(type) {
case *map[string]interface{}:
@ -73,6 +73,9 @@ func unmarshal(data []byte, f Format, v interface{}) error {
err = toml.Unmarshal(data, v)
case YAML:
err = yaml.Unmarshal(data, v)
if err != nil {
return errors.Wrap(err, "failed to unmarshal YAML")
}
// To support boolean keys, the YAML package unmarshals maps to
// map[interface{}]interface{}. Here we recurse through the result
@ -100,7 +103,7 @@ func unmarshal(data []byte, f Format, v interface{}) error {
return errors.Errorf("unmarshal of format %q is not supported", f)
}
return err
return errors.Wrap(err, "unmarshal failed")
}