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
Thanks for the support to interface{} - I actually have a great usecase for it in my app.
I discovered the bug writing some throw-away code.
If you have a struct like so:
type Test struct {
Anything interface{}
}
t := Test{"teststring"}
gob.Encode gives you:
2010/10/21 17:29:11 rpc: writing response: gob: type not registered for interface: string
calling gob.Register("") from my init() solves the problem, but it seems like
encodeInterface() needs to check built-in types as well as concreteTypeToName.
The text was updated successfully, but these errors were encountered:
Follow-up - calling gob.Register("") actually screwed up the encoding of other types
when I plugged in the rpc system.
The internal state of the decoder looked like this:
error range 3 >= 2 []gob.decInstr{gob.decInstr{op:(gob.decOp)(0x8090e0f), field:0,
indir:0, offset:0x0, ovfl:"value for \"name\" out of range"},
gob.decInstr{op:(gob.decOp)(0x80906ca), field:1, indir:0, offset:0x8, ovfl:"value for
\"_id\" out of range"}}
mikioh
changed the title
new gob support for interface{} breaks for built-in types
encoding/gob: new gob support for interface{} breaks for built-in types
Feb 26, 2015
The text was updated successfully, but these errors were encountered: