Open
Description
json.Unmarshal
causes panic when a map to a struct values that has UnmarshalText
is given.
https://gopherjs.github.io/playground/#/QeyQssFhyq
package main
import (
"encoding/json"
"fmt"
)
type Object [3]byte
func (o Object) UnmarshalText(text []byte) error {
return nil
}
func main() {
const jsonStr = `{"foo": "foo"}`
vals := map[string]Object{}
if err := json.Unmarshal([]byte(jsonStr), &vals); err != nil {
panic(err)
}
fmt.Printf("%#v\n", vals["foo"])
}
Expected result:
No panics.
Actual result
panic: ap.$get is not a function