Open NicolasMahe opened 4 years ago
This PR fixes a bug in the function decodeReflectJSONStruct.
decodeReflectJSONStruct
To decode each field of the struct, this function is calling decodeReflectJSON. The issue was instead of using each field.FieldOptions, it was passing its parameter fopts FieldOptions: https://github.com/tendermint/go-amino/blob/59d50ef176f686dc2c0c150e85a9381a78b9978a/json-decode.go#L416
decodeReflectJSON
field.FieldOptions
fopts FieldOptions
The binary version decodeReflectBinaryStruct is already using each field.FieldOptions, so I just apply the same logic to the json version. https://github.com/tendermint/go-amino/blob/59d50ef176f686dc2c0c150e85a9381a78b9978a/binary-decode.go#L867
decodeReflectBinaryStruct
I also add a new Unsafe struct to json_test.go to unit test the issue. Without the fix, the tests are failing.
Unsafe
json_test.go
Here is the link to the failed CI test before the fix: https://app.circleci.com/jobs/github/tendermint/go-amino/670
Are there plans for this to be merged please?
I don't think this repo is being maintained. Better to fork and continue from there.
This PR fixes a bug in the function
decodeReflectJSONStruct
.To decode each field of the struct, this function is calling
decodeReflectJSON
. The issue was instead of using eachfield.FieldOptions
, it was passing its parameterfopts FieldOptions
: https://github.com/tendermint/go-amino/blob/59d50ef176f686dc2c0c150e85a9381a78b9978a/json-decode.go#L416The binary version
decodeReflectBinaryStruct
is already using eachfield.FieldOptions
, so I just apply the same logic to the json version. https://github.com/tendermint/go-amino/blob/59d50ef176f686dc2c0c150e85a9381a78b9978a/binary-decode.go#L867I also add a new
Unsafe
struct tojson_test.go
to unit test the issue. Without the fix, the tests are failing.Here is the link to the failed CI test before the fix: https://app.circleci.com/jobs/github/tendermint/go-amino/670