(path string, structsA[] ComponentDefinitionStruct, structsB[] ComponentDefinitionStruct)
| 627 | |
| 628 | |
| 629 | func diffStructs(path string, structsA[] ComponentDefinitionStruct, structsB[] ComponentDefinitionStruct) ([]ComponentDiffElementAdd, []ComponentDiffElementRemove, []ComponentDiffAttributeChange, error) { |
| 630 | changes := make([]ComponentDiffAttributeChange, 0) |
| 631 | adds := make([]ComponentDiffElementAdd, 0) |
| 632 | removes := make([]ComponentDiffElementRemove, 0) |
| 633 | |
| 634 | for _, structA := range(structsA) { |
| 635 | BHasStructA := false |
| 636 | for _, structB := range(structsB) { |
| 637 | if structA.Name == structB.Name { |
| 638 | BHasStructA = true |
| 639 | EAdds, ERemoves, Echanges, err := diffStruct(path, structA, structB) |
| 640 | if (err != nil) { |
| 641 | return adds, removes, changes, err |
| 642 | } |
| 643 | adds = append(adds, EAdds...) |
| 644 | removes = append(removes, ERemoves...) |
| 645 | changes = append(changes, Echanges...) |
| 646 | break; |
| 647 | } |
| 648 | } |
| 649 | if (!BHasStructA) { |
| 650 | var remove ComponentDiffElementRemove |
| 651 | remove.Path = path |
| 652 | remove.Removal = structA |
| 653 | removes = append(removes, remove) |
| 654 | } |
| 655 | } |
| 656 | |
| 657 | for _, structB := range(structsB) { |
| 658 | AHasStructB := false |
| 659 | for _, structA := range(structsA) { |
| 660 | if structB.Name == structA.Name { |
| 661 | AHasStructB = true |
| 662 | break; |
| 663 | } |
| 664 | } |
| 665 | if (!AHasStructB) { |
| 666 | var add ComponentDiffElementAdd |
| 667 | add.Path = path |
| 668 | add.Addition = structB |
| 669 | adds = append(adds, add) |
| 670 | } |
| 671 | } |
| 672 | |
| 673 | return adds, removes, changes, nil |
| 674 | } |
| 675 | |
| 676 | |
| 677 | func diffComponentAttributes(path string, componentA ComponentDefinition, componentB ComponentDefinition) ([]ComponentDiffAttributeChange, error) { |
no test coverage detected