dnscrypt-proxy/vendor/github.com/BurntSushi/toml/decode_go116.go

20 lines
358 B
Go
Raw Normal View History

2022-01-13 09:22:22 +01:00
//go:build go1.16
2021-08-08 10:21:25 +02:00
// +build go1.16
package toml
import (
"io/fs"
)
2022-10-24 10:20:25 +02:00
// DecodeFS reads the contents of a file from [fs.FS] and decodes it with
// [Decode].
2021-08-08 10:21:25 +02:00
func DecodeFS(fsys fs.FS, path string, v interface{}) (MetaData, error) {
fp, err := fsys.Open(path)
if err != nil {
return MetaData{}, err
}
defer fp.Close()
return NewDecoder(fp).Decode(v)
}