MCPcopy Create free account
hub / github.com/aws-cloudformation/rain / formatMap

Function formatMap

cft/diff/format.go:85–109  ·  view source on GitHub ↗
(m dmap, path []interface{}, long bool)

Source from the content-addressed store, hash-verified

83}
84
85func formatMap(m dmap, path []interface{}, long bool) string {
86 output := strings.Builder{}
87
88 keys := m.keys()
89 sort.Strings(keys)
90
91 for _, k := range keys {
92 v := m[k]
93 m := v.Mode()
94
95 if !long && m == Unchanged {
96 continue
97 }
98
99 output.WriteString(fmt.Sprintf("%s %s:", m, k))
100
101 if !long && (m == Removed || m == Unchanged) {
102 output.WriteString(" " + stubValue(v.(value)) + "\n")
103 } else {
104 output.WriteString(formatSub(v, append(path, k), long))
105 }
106 }
107
108 return output.String()
109}
110
111func formatSub(d Diff, path []interface{}, long bool) string {
112 // Format the element

Callers 2

FormatMethod · 0.85
formatDiffFunction · 0.85

Calls 5

stubValueFunction · 0.85
formatSubFunction · 0.85
keysMethod · 0.80
ModeMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected