mirror of https://github.com/chubin/wttr.in
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
302 B
15 lines
302 B
2 years ago
|
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)
|
||
|
}
|