From 707ad09ba51e8f6b590fb4122d53851b1089f6c0 Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Fri, 27 Dec 2019 19:06:58 +1100 Subject: [PATCH] Refactor wip --- pkg/yqlib/data_navigator.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/yqlib/data_navigator.go b/pkg/yqlib/data_navigator.go index 23734111..84bac231 100644 --- a/pkg/yqlib/data_navigator.go +++ b/pkg/yqlib/data_navigator.go @@ -82,11 +82,13 @@ func (n *navigator) recurseMap(value *yaml.Node, head string, tail []string, pat log.Debug("should I traverse? %v", head) DebugNode(value) - if n.navigationSettings.ShouldTraverse(contents[indexInMap+1], head, tail, append(pathStack, contents[indexInMap].Value)) == true { + newPath := append(pathStack, contents[indexInMap].Value) + + if n.navigationSettings.ShouldTraverse(contents[indexInMap+1], head, tail, newPath) == true { log.Debug("yep!") traversedEntry = true contents[indexInMap+1] = n.getOrReplace(contents[indexInMap+1], guessKind(tail, contents[indexInMap+1].Kind)) - return n.doTraverse(contents[indexInMap+1], head, tail, append(pathStack, contents[indexInMap].Value)) + return n.doTraverse(contents[indexInMap+1], head, tail, newPath) } else { log.Debug("nope not traversing") }