From f3cc0cc7ada23f322eababaa8ffe33c96b46adea Mon Sep 17 00:00:00 2001 From: Celestino Amoroso Date: Sat, 13 Jul 2024 09:00:53 +0200 Subject: [PATCH] operator-include.go: Fixed inclusion of a list of files. Now returns the value of the last evaluated expression. --- operator-include.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/operator-include.go b/operator-include.go index 520396e..3bd201d 100644 --- a/operator-include.go +++ b/operator-include.go @@ -25,8 +25,8 @@ func evalInclude(ctx ExprContext, opTerm *term) (v any, err error) { count := 0 if IsList(childValue) { - list, _ := childValue.([]any) - for i, filePathSpec := range list { + list, _ := childValue.(*ListType) + for i, filePathSpec := range *list { if filePath, ok := filePathSpec.(string); ok { if v, err = EvalFile(ctx, filePath); err == nil { count++ @@ -47,8 +47,9 @@ func evalInclude(ctx ExprContext, opTerm *term) (v any, err error) { } else { err = opTerm.errIncompatibleType(childValue) } - if err == nil { - v = count + if err != nil { + //v = count + v = nil } return }