#Mspack: Serializing *big.Float (panic: runtime error: invalid memory address or nil pointer..)

9 messages · Page 1 of 1 (latest)

upper tundra
#

which msg pack library do you use?

#

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.

upper tundra
#

does this code that you posted work?

upper tundra
#

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

kindred jay
#

just implement the interfaces for your custom type. the implementations should use value receiver and should just call (*big.Float).(Un)MarshalText