diff --git a/go.mod b/go.mod index a7d950ae..8c8985c6 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/gin-contrib/cors v1.5.0 github.com/gin-gonic/gin v1.9.1 github.com/jinzhu/copier v0.4.0 - github.com/jmespath-community/go-jmespath v1.1.2-0.20231004164315-78945398586a + github.com/jmespath-community/go-jmespath v1.1.2-0.20231123142750-72f7c13d265e github.com/kyverno/kyverno v1.5.0-rc1.0.20231029235953-c96199dee1f6 github.com/loopfz/gadgeto v0.11.3 github.com/nlepage/go-wasm-http-server v1.1.0 diff --git a/go.sum b/go.sum index 2f7ff066..64d1af52 100644 --- a/go.sum +++ b/go.sum @@ -203,8 +203,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8= github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= -github.com/jmespath-community/go-jmespath v1.1.2-0.20231004164315-78945398586a h1:8W5d74FhEWTJPnFwpDDxbwUK3pPLUbY4RlfN2uzTTSE= -github.com/jmespath-community/go-jmespath v1.1.2-0.20231004164315-78945398586a/go.mod h1:4gOyFJsR/Gk+05RgTKYrifT7tBPWD8Lubtb5jRrfy9I= +github.com/jmespath-community/go-jmespath v1.1.2-0.20231123142750-72f7c13d265e h1:mT/Ah0Ywodd7qzMw7eXF4/dv55+LnYSOAHhAPs1sNnM= +github.com/jmespath-community/go-jmespath v1.1.2-0.20231123142750-72f7c13d265e/go.mod h1:j4OeykGPBbhX3rw4AOPGXSmX2/zuWXktm704A4MtHFs= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jonboulle/clockwork v0.3.0 h1:9BSCMi8C+0qdApAp4auwX0RkLGUjs956h0EkuQymUhg= github.com/jonboulle/clockwork v0.3.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= diff --git a/pkg/engine/template/template.go b/pkg/engine/template/template.go index df70d87a..976fbb93 100644 --- a/pkg/engine/template/template.go +++ b/pkg/engine/template/template.go @@ -36,10 +36,10 @@ func String(ctx context.Context, in string, value interface{}, bindings binding. } func Execute(ctx context.Context, statement string, value interface{}, bindings binding.Bindings) (interface{}, error) { - interpreter := interpreter.NewInterpreter(nil, caller, bindings) + vm := interpreter.NewInterpreter(nil, bindings) compiled, err := parser.Parse(statement) if err != nil { return nil, err } - return interpreter.Execute(compiled, value) + return vm.Execute(compiled, value, interpreter.WithFunctionCaller(caller)) }