From 4abdca159a0677f2bf24798e04f4ac9a9e5747fd Mon Sep 17 00:00:00 2001 From: Noel Cower Date: Mon, 1 Oct 2018 16:22:11 -0700 Subject: [PATCH] Fix child reassignment after Map This fixes a bug that was introduced in e6ce13f9 where the newChild was checked and added to the child list but was not walked after being mapped. This resulted in invalid handling of the child, since the walk would then proceed incorrectly with the original child instead of its replacement. This in particular breaks things like include mappings that replace a statement with a document (or collection of documents). --- walk.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/walk.go b/walk.go index 1348e53..e8bca8d 100644 --- a/walk.go +++ b/walk.go @@ -82,7 +82,9 @@ func walkInContext(context, parent ParentNode, walker Walker) (err error) { i-- continue } - children[i] = newChild + + child = newChild + children[i] = child } switch child := child.(type) {