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

Function appendMappingDiffs

internal/node/node.go:333–356  ·  view source on GitHub ↗
(diffs []string, node1, node2 *yaml.Node)

Source from the content-addressed store, hash-verified

331}
332
333func appendMappingDiffs(diffs []string, node1, node2 *yaml.Node) []string {
334 keys1 := make(map[string]yaml.Node)
335 keys2 := make(map[string]yaml.Node)
336
337 for _, child := range node1.Content {
338 keys1[child.Value] = *child
339 }
340 for _, child := range node2.Content {
341 keys2[child.Value] = *child
342 }
343
344 for k, v := range keys1 {
345 if v2, ok := keys2[k]; ok {
346 diffs = appendDiffs(diffs, &v, &v2)
347 delete(keys2, k)
348 } else {
349 diffs = append(diffs, fmt.Sprintf("Node1: %v", v.Value))
350 }
351 }
352 for _, v := range keys2 {
353 diffs = append(diffs, fmt.Sprintf("Node2: %v", v.Value))
354 }
355 return diffs
356}
357
358func appendSequenceDiffs(diffs []string, node1, node2 *yaml.Node) []string {
359 for i := 0; i < len(node1.Content) && i < len(node2.Content); i++ {

Callers 1

DiffFunction · 0.85

Calls 1

appendDiffsFunction · 0.85

Tested by

no test coverage detected