We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package main import ( "github.com/ugorji/go/codec" "bytes" "log" ) type A struct { Aint int } type B struct { *A Bint int } type C struct { *A Cint int } type D struct { Structs map[string]*B Array []*C } func main() { obj := &D{ Structs: map[string]*B{ "test": &B{&A{5}, 6}, }, } var m codec.MsgpackHandle m.StructToArray = true var buf bytes.Buffer encoder := codec.NewEncoder(&buf, &m) if err := encoder.Encode(obj); err != nil { log.Fatal("Failed to encode:", err) } decoder := codec.NewDecoder(&buf, &m) d := D{} if err := decoder.Decode(&d); err != nil { log.Fatal("Failed to decode:", err) } log.Println(d) }
This code receives the error: reflect: call of reflect.Value.Field on ptr Value
reflect: call of reflect.Value.Field on ptr Value
It runs correctly when the struct pointers are named and not embedded OR the StructToArray option is turned off.
The text was updated successfully, but these errors were encountered:
I knew I should have slept over it.
Structs can be decoded from an array or a map in the stream.
I did the fix for the map in the stream, but not for the array.
Now fix. Submitting right away.
Sorry, something went wrong.
bb8ac5b
No branches or pull requests
This code receives the error:
reflect: call of reflect.Value.Field on ptr Value
It runs correctly when the struct pointers are named and not embedded OR the StructToArray option is turned off.
The text was updated successfully, but these errors were encountered: