-
Notifications
You must be signed in to change notification settings - Fork 600
Open
Description
If I have a Go struct containing a pointer to a map, I'm unable to use that structure in Otto.
Here's an example test case:
func TestGoStructMapPointerField(t *testing.T) {
type S struct {
A *map[string]any `json:"a"`
}
tt(t, func() {
test, vm := test()
vm.Set("s", S{A: &map[string]any{
"one": 1,
}})
test(`'a' in s`, true)
test(`s.a.one`, 1)
})
}And the resulting error:
--- FAIL: TestGoStructMapPointerField (0.00s)
panic: TypeError: invalid value (map): missing runtime: map[one:1] (map[string]interface {}) [recovered]
panic: TypeError: invalid value (map): missing runtime: map[one:1] (map[string]interface {}) [recovered]
panic: TypeError: invalid value (map): missing runtime: map[one:1] (map[string]interface {}) [recovered]
panic: TypeError: invalid value (map): missing runtime: map[one:1] (map[string]interface {})
Metadata
Metadata
Assignees
Labels
No labels