#Mspack: Serializing *big.Float (panic: runtime error: invalid memory address or nil pointer..)
9 messages · Page 1 of 1 (latest)
also your error message has nothing to do with the library itself but actually with you defining a *big.Float pointer that is nil and not initialized.
does this code that you posted work?
maybe you will need to manually encode it: https://pkg.go.dev/github.com/vmihailenco/msgpack/v5#CustomEncoder
as well as decode
I would suggest directly usong the typ without wrapping it in a struct
big.Float implements encoding.Text(Un)Marshaler which is seemingly checked by msgpack. You wrapping in a different struct hides that implementation
just implement the interfaces for your custom type. the implementations should use value receiver and should just call (*big.Float).(Un)MarshalText