mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-25 21:39:10 +00:00
48d5a1cd1a
Signed-off-by: Evan Lezar <elezar@nvidia.com>
20 lines
399 B
Go
20 lines
399 B
Go
//go:build go1.16
|
|
// +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)
|
|
}
|