databricks-cli/libs/config/yamlloader/yaml.go

23 lines
382 B
Go
Raw Normal View History

2023-10-20 12:56:59 +00:00
package yamlloader
import (
"io"
"github.com/databricks/cli/libs/config"
"gopkg.in/yaml.v3"
)
func LoadYAML(path string, r io.Reader) (config.Value, error) {
var node yaml.Node
dec := yaml.NewDecoder(r)
err := dec.Decode(&node)
if err != nil {
if err == io.EOF {
return config.NilValue, nil
}
2023-10-20 12:56:59 +00:00
return config.NilValue, err
}
return newLoader(path).load(&node)
}