-
-
Notifications
You must be signed in to change notification settings - Fork 473
Closed
Description
Hello!
Very new to this repo so looking for some advice on what may be causing the issues I am about to describe.
I have a sample go program as follows:
package main
import (
"fmt"
"github.com/Masterminds/sprig/v3"
"github.com/expr-lang/expr"
)
func main() {
// Example map to test dig
labels := map[string]any{
"some": map[string]any{
"label": map[string]any{
"io/creator-email": "test@example.com",
},
},
}
// Build environment with dig
env := map[string]any{
"sprig": sprig.GenericFuncMap(),
"labels": labels,
}
// Compile expression
program, err := expr.Compile("sprig.dig('some', 'label', 'io/creator-email', nil, labels)", expr.Env(env))
if err != nil {
fmt.Println("Compile error:", err)
return
}
// Run expression
output, err := expr.Run(program, env)
if err != nil {
fmt.Println("Runtime error:", err)
return
}
fmt.Println("Result:", output)
}
When using this program with expr-lang 1.16.9 I get:
Result: test@example.com
However, when upgrading to 1.17.X (while keeping sprig module the same) I get:
Runtime error: runtime error: index out of range [3] with length 1 (1:7)
| sprig.dig('some', 'label', 'io/creator-email', nil, labels)
| ......^
Any thought what may be causing this?
Metadata
Metadata
Assignees
Labels
No labels