MCPcopy
hub / github.com/grafana/tempo / YAMLMarshalUnmarshal

Function YAMLMarshalUnmarshal

pkg/util/yaml.go:7–19  ·  view source on GitHub ↗

YAMLMarshalUnmarshal utility function that converts a YAML interface in a map doing marshal and unmarshal of the parameter

(in interface{})

Source from the content-addressed store, hash-verified

5// YAMLMarshalUnmarshal utility function that converts a YAML interface in a map
6// doing marshal and unmarshal of the parameter
7func YAMLMarshalUnmarshal(in interface{}) (map[interface{}]interface{}, error) {
8 yamlBytes, err := yaml.Marshal(in)
9 if err != nil {
10 return nil, err
11 }
12
13 object := make(map[interface{}]interface{})
14 if err := yaml.Unmarshal(yamlBytes, object); err != nil {
15 return nil, err
16 }
17
18 return object, nil
19}

Callers 2

writeStatusConfigMethod · 0.92

Calls 2

MarshalMethod · 0.65
UnmarshalMethod · 0.65

Tested by

no test coverage detected