From 2344638da45f2d16e271748b2657665d0bd51cde Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Sun, 15 Dec 2019 18:53:49 +1100 Subject: [PATCH] Fixed delete splat --- pkg/yqlib/data_navigator.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/yqlib/data_navigator.go b/pkg/yqlib/data_navigator.go index 17b2542b..6aa0ad0c 100644 --- a/pkg/yqlib/data_navigator.go +++ b/pkg/yqlib/data_navigator.go @@ -89,7 +89,8 @@ func (n *navigator) Delete(rootNode *yaml.Node, path []string) error { nodeToUpdate.Content = append(original[:index], original[index+1:]...) } else if nodeToUpdate.Kind == yaml.MappingNode { - // need to delete in reverse... + // need to delete in reverse - otherwise the matching indexes + // become incorrect. matchingIndices := make([]int, 0) _, errorVisiting := n.visitMatchingEntries(nodeToUpdate.Content, lastBit, func(indexInMap int) error { matchingIndices = append(matchingIndices, indexInMap)