MCPcopy Index your code
hub / github.com/databus23/helm-diff / manifestToJSON

Function manifestToJSON

diff/structured.go:87–106  ·  view source on GitHub ↗
(m *manifest.MappingResult)

Source from the content-addressed store, hash-verified

85}
86
87func manifestToJSON(m *manifest.MappingResult) ([]byte, map[string]interface{}, error) {
88 if m == nil || strings.TrimSpace(m.Content) == "" {
89 return nil, nil, nil
90 }
91 jsonBytes, err := yaml.YAMLToJSON([]byte(m.Content))
92 if err != nil {
93 return nil, nil, err
94 }
95
96 if len(jsonBytes) == 0 || string(jsonBytes) == "null" {
97 return jsonBytes, nil, nil
98 }
99
100 var obj map[string]interface{}
101 if err := json.Unmarshal(jsonBytes, &obj); err != nil {
102 return nil, nil, err
103 }
104
105 return jsonBytes, obj, nil
106}
107
108func (e *StructuredEntry) populateMetadata(key string, objects ...map[string]interface{}) {
109 for _, obj := range objects {

Callers 1

buildStructuredEntryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected