mirror of
https://github.com/chubin/wttr.in
synced 2025-01-12 12:08:47 +00:00
15 lines
302 B
Go
15 lines
302 B
Go
|
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)
|
||
|
}
|