mirror of https://github.com/chubin/wttr.in
parent
b54ba36643
commit
307476764a
@ -0,0 +1,14 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
// YamlUnmarshalStrict unmarshals YAML data with an error when unknown fields are present.
|
||||
func YamlUnmarshalStrict(in []byte, out interface{}) error {
|
||||
dec := yaml.NewDecoder(bytes.NewReader(in))
|
||||
dec.KnownFields(true)
|
||||
return dec.Decode(out)
|
||||
}
|
Loading…
Reference in new issue