aboutsummaryrefslogblamecommitdiff
path: root/vendor/github.com/BurntSushi/toml/decode_go116.go
blob: 086d0b68664f669f3e00a5d76de53df7fccd4aa4 (plain) (tree)
1
2
3
4
5
6
7
8
9
                 







                

                                                                         







                                                                         
//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)
}