Closed defgenx closed 4 years ago
This package supports MarshalBinary and UnmarshalBinary (along with the Text and JSON variants).
Consequently, you should not use it to implement these functions, else you get into a loop (as seen).
i.e.
That's the loop.
encoding/json doesn't have this issue, because encoding/json only supports MarshalText/MarshalJSON. I reckon implementing those methods will cause same issue.
Hi.
I tried to create a struct that implement
BinaryMarshaler
andBinaryUnmarshaler
and my program produce the following error:Here is the code:
Maybe I did something wrong but I don't have the same behaviour with the
encoding/json
package. Can you explain me what is going on here ?Thanks a lot !