Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix unmarshal to map doesn't report error with null key #401

Open
wants to merge 1 commit into
base: master
from

Conversation

@lefelys
Copy link

@lefelys lefelys commented Sep 4, 2019

Change aimed to fix unmarshaling json with null key to map[string]interface{} not reporting error.
Standard library handles this case properly reporting error

@codecov
Copy link

@codecov codecov bot commented Sep 4, 2019

Codecov Report

Merging #401 into master will decrease coverage by 0.28%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #401      +/-   ##
==========================================
- Coverage   81.81%   81.53%   -0.29%     
==========================================
  Files          41       41              
  Lines        5022     5026       +4     
==========================================
- Hits         4109     4098      -11     
- Misses        792      807      +15     
  Partials      121      121
Impacted Files Coverage Δ
reflect_map.go 87.74% <100%> (+0.24%) ⬆️
reflect_struct_decoder.go 47.07% <0%> (-2.09%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 27518f6...755fc98. Read the comment docs.

@codecov
Copy link

@codecov codecov bot commented Sep 4, 2019

Codecov Report

Merging #401 into master will decrease coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #401      +/-   ##
==========================================
- Coverage   81.81%   81.77%   -0.05%     
==========================================
  Files          41       41              
  Lines        5022     5026       +4     
==========================================
+ Hits         4109     4110       +1     
- Misses        792      795       +3     
  Partials      121      121
Impacted Files Coverage Δ
reflect_map.go 87.74% <100%> (+0.24%) ⬆️
reflect_struct_decoder.go 48.74% <0%> (-0.42%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 27518f6...4a3d4a0. Read the comment docs.

@taowen
Copy link
Contributor

@taowen taowen commented Oct 17, 2019

should fix this problem by change "decoderOfMapKey", as other map key decoder can detect the problem.

@lefelys
Copy link
Author

@lefelys lefelys commented Dec 19, 2019

JSON keys are strings by the standard, I think mapDecoder must check it during decoding regardless map key type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.