1
0
Fork 0
mirror of https://github.com/vbatts/freezing-octo-hipster.git synced 2024-11-24 07:55:39 +00:00
random-utils/vendor/github.com/BurntSushi/toml/decode_go116.go
Vincent Batts 4ab3be9bc6
go*: one go module for the repo, no more nested
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2024-04-26 19:34:55 +00:00

19 lines
358 B
Go

//go:build go1.16
// +build go1.16
package toml
import (
"io/fs"
)
// DecodeFS reads the contents of a file from [fs.FS] and decodes it with
// [Decode].
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)
}