MCPcopy
hub / github.com/cortexlabs/cortex / ReadYAMLBytes

Function ReadYAMLBytes

pkg/lib/configreader/reader.go:1081–1091  ·  view source on GitHub ↗
(yamlBytes []byte)

Source from the content-addressed store, hash-verified

1079}
1080
1081func ReadYAMLBytes(yamlBytes []byte) (interface{}, error) {
1082 if len(yamlBytes) == 0 {
1083 return nil, nil
1084 }
1085 var parsed interface{}
1086 err := yaml.Unmarshal(yamlBytes, &parsed)
1087 if err != nil {
1088 return nil, ErrorInvalidYAML(err)
1089 }
1090 return parsed, nil
1091}
1092
1093func ReadJSONBytes(jsonBytes []byte) (interface{}, error) {
1094 if len(jsonBytes) == 0 {

Callers 4

ParseYAMLBytesFunction · 0.85
ReadYAMLFileFunction · 0.85
MustReadYAMLStrFunction · 0.85
MustReadYAMLStrMapFunction · 0.85

Calls 1

ErrorInvalidYAMLFunction · 0.85

Tested by

no test coverage detected