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": "[email protected]",
},
},
}
// 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: [email protected]
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
Activity
[-]Compatibility issues with sprig functions between 1.16 and 1.17[/-][+]Compatibility issues with sprig dig function between 1.16 and 1.17[/+]thevilledev commentedon Dec 10, 2025
Hey!
I wrote a small test case to try and reproduce this:
Runs fine on v1.16.9, but fails on all tagged releases after to the same error you're seeing:
But the good thing is that it runs fine on
master. I believe I fixed this in #868. It will be part of the next release, presumably v1.17.7.antonmedv commentedon Dec 10, 2025
Yes! I will release v1.17.7 very soon 🙌