From 716b6f3e9271f9693ea90b3c9e9ad0ea855ea32b Mon Sep 17 00:00:00 2001 From: tobb10001 Date: Mon, 15 Jan 2024 22:05:10 +0100 Subject: [PATCH] fix PathBuilder.Root() for non-chained method calls --- path.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/path.go b/path.go index 72554bd8..7ec9fb5d 100644 --- a/path.go +++ b/path.go @@ -372,7 +372,9 @@ type PathBuilder struct { // Root add '$' to current path. func (b *PathBuilder) Root() *PathBuilder { root := newRootNode() - return &PathBuilder{root: root, node: root} + b.root = root + b.node = root + return b } // IndexAll add '[*]' to current path.