Hi, thank you for your time and for reading. I'm trying to slice an array passed in the environment but I'm getting a runtime error reflect.Value.Slice: slice of unaddressable array. Example (Go Playground):
prog, err:=expr.Compile(`arr[1:2]`)
iferr!=nil {
panic(err)
}
val, err:=expr.Run(prog, map[string]any{
"arr": [5]int{0, 1, 2, 3, 4},
})
iferr!=nil {
panic(err)
}
fmt.Println("Result:", val)I also tried to pass &[5]int{0, 1, 2, 3, 4} instead but didn't work either.
EDIT: I made a PR with a fix, but let me know if it's appropriate or if you would rather discuss a better approach instead.
Hi, thank you for your time and for reading. I'm trying to slice an array passed in the environment but I'm getting a runtime error
reflect.Value.Slice: slice of unaddressable array. Example (Go Playground):I also tried to pass
&[5]int{0, 1, 2, 3, 4}instead but didn't work either.EDIT: I made a PR with a fix, but let me know if it's appropriate or if you would rather discuss a better approach instead.