From 760965ee49a9c36182ed802da453186854a0fce0 Mon Sep 17 00:00:00 2001 From: James Hamlin Date: Sat, 27 Jan 2024 16:50:59 -0800 Subject: [PATCH] Fix builtin Signed-off-by: James Hamlin --- pkg/lang/builtins.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/lang/builtins.go b/pkg/lang/builtins.go index d52759f..6336077 100644 --- a/pkg/lang/builtins.go +++ b/pkg/lang/builtins.go @@ -211,7 +211,7 @@ func GoSlice(slc interface{}, indices ...interface{}) interface{} { if len(indices) == 0 { panic(fmt.Errorf("slice: no indices")) } - if len(indices) == 1 { + if len(indices) >= 1 { if !IsNil(indices[0]) { i = MustAsInt(indices[0]) } @@ -221,6 +221,7 @@ func GoSlice(slc interface{}, indices ...interface{}) interface{} { j = MustAsInt(indices[1]) } } + return slcVal.Slice(i, j).Interface() }