TIL
A TOML decoder can list the keys it ignored
toml.DecodeFile from BurntSushi/toml returns a MetaData, and its Undecoded() lists every key in the file that matched no field. Pegel 0.9.0 uses it to refuse a typo such as intervall instead of ignoring it.
md, err := toml.DecodeFile(path, &cfg)
if err != nil {
return nil, err
}
if keys := md.Undecoded(); len(keys) > 0 {
return nil, fmt.Errorf("%s: unknown key %q", path, keys[0].String())
}Before, a misspelt key fell back to its default without a word, and nobody suspects a default.
subscribe
New entries and the next chapter by mail, nothing else.