-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
Reproducible example: https://play.golang.org/p/uugW5Adb3-J
In the example, the decodeInt function implements a value decoder for int32 that reads an int32 from the ValueReader and multiplies it by -1 before setting it in the struct. The expected output from the main function is
{"int": {"$numberInt":"1"}}
{Int:-1}but the actual output is
{"int": {"$numberInt":"1"}}
{Int:1}When using MarshalWithRegistry followed by UnmarshalWithRegistry, everything works as expected. When using Marshal followed by UnmarshalWithRegistry, the custom decoder is not honored.