50fbc2eec2
* CI: use staticcheck for linting This commit switches the linter for Go code from golint to staticcheck. Golint has been deprecated since last year and staticcheck is a recommended replacement. Signed-off-by: Lucas Servén Marín <lserven@gmail.com> * revendor Signed-off-by: Lucas Servén Marín <lserven@gmail.com> * cmd,pkg: fix lint warnings Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
19 lines
381 B
Go
19 lines
381 B
Go
// +build go1.16
|
|
|
|
package toml
|
|
|
|
import (
|
|
"io/fs"
|
|
)
|
|
|
|
// DecodeFS is just like Decode, except it will automatically read the contents
|
|
// of the file at `path` from a fs.FS instance.
|
|
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)
|
|
}
|