From 406bbb8ca46e0f33482ecc0bd3ea76cd8fa73c22 Mon Sep 17 00:00:00 2001 From: Mikhail Katychev Date: Mon, 14 Mar 2022 21:28:52 -0500 Subject: [PATCH] handled EvaluateNodes panic (#1140) --- pkg/yqlib/all_at_once_evaluator.go | 1 + pkg/yqlib/all_at_once_evaluator_test.go | 1 - pkg/yqlib/expression_parser_test.go | 4 +--- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/yqlib/all_at_once_evaluator.go b/pkg/yqlib/all_at_once_evaluator.go index 69c8c47c..066edd0d 100644 --- a/pkg/yqlib/all_at_once_evaluator.go +++ b/pkg/yqlib/all_at_once_evaluator.go @@ -22,6 +22,7 @@ type allAtOnceEvaluator struct { } func NewAllAtOnceEvaluator() Evaluator { + InitExpressionParser() return &allAtOnceEvaluator{treeNavigator: NewDataTreeNavigator()} } diff --git a/pkg/yqlib/all_at_once_evaluator_test.go b/pkg/yqlib/all_at_once_evaluator_test.go index 546e3d84..2e9abc43 100644 --- a/pkg/yqlib/all_at_once_evaluator_test.go +++ b/pkg/yqlib/all_at_once_evaluator_test.go @@ -31,7 +31,6 @@ var evaluateNodesScenario = []expressionScenario{ } func TestAllAtOnceEvaluateNodes(t *testing.T) { - InitExpressionParser() var evaluator = NewAllAtOnceEvaluator() for _, tt := range evaluateNodesScenario { node := test.ParseData(tt.document) diff --git a/pkg/yqlib/expression_parser_test.go b/pkg/yqlib/expression_parser_test.go index d31792eb..4c89d207 100644 --- a/pkg/yqlib/expression_parser_test.go +++ b/pkg/yqlib/expression_parser_test.go @@ -7,9 +7,7 @@ import ( ) func getExpressionParser() ExpressionParserInterface { - if ExpressionParser == nil { - ExpressionParser = newExpressionParser() - } + InitExpressionParser() return ExpressionParser }