You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unmarshal should allocate the embedded struct so that we can call UnmarshalJSON()
this would only be relevant if there were only 1 embedded struct which implements UnmarshalJSON
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/DZoQ9ro3jv7
my parent struct inherits
UnmarshalJSON(data []byte) error
from the embedded structhttps://github.com/golang/go/blob/master/src/encoding/json/decode.go#L492
in the
indirect()
functionif u, ok := v.Interface().(Unmarshaler); ok {
is true, but since the embedded struct is not allocated it will cause a nil pointer exceptionWhat did you expect to see?
&{&{}}
What did you see instead?
&{<nil>}
Unmarshal should allocate the embedded struct so that we can call UnmarshalJSON()
this would only be relevant if there were only 1 embedded struct which implements UnmarshalJSON
The text was updated successfully, but these errors were encountered: