From d66666f2006c7e9e60ef491563c406f529a21af8 Mon Sep 17 00:00:00 2001 From: Novan <25704935+nofun97@users.noreply.github.com> Date: Tue, 22 Feb 2022 10:07:47 +1100 Subject: [PATCH] ensure stdlib is loaded once for //eval.eval (#249) Previously, //eval.eval calls SafeStdScopeTuple function which rebuilds the stdlib. This is unnecessary as the function SafeStdScope uses sync.Once which avoids rebuilding the arrai stdlib. This commit ensures that //eval.eval loads stdlib once by calling SafeStdScope. --- syntax/std_eval.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/std_eval.go b/syntax/std_eval.go index 4a757657..bc675084 100644 --- a/syntax/std_eval.go +++ b/syntax/std_eval.go @@ -45,7 +45,7 @@ func contextualEval(ctx context.Context, config EvalConfig, v rel.Value) (rel.Va } scope = scope.With("//", localLib) } else { - scope = scope.With("//", SafeStdScopeTuple()) + scope = scope.Update(SafeStdScope()) } for e := config.scopes.Enumerator(); e.MoveNext(); { name, value := e.Current()