YAMLMarshalUnmarshal utility function that converts a YAML interface in a map doing marshal and unmarshal of the parameter
(in interface{})
| 5 | // YAMLMarshalUnmarshal utility function that converts a YAML interface in a map |
| 6 | // doing marshal and unmarshal of the parameter |
| 7 | func 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 | } |
no test coverage detected