-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[chore] Make mapstructure hooks safe against untyped nils #13001
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
[chore] Make mapstructure hooks safe against untyped nils #13001
Conversation
Codecov ReportAttention: Patch coverage is
❌ Your patch status has failed because the patch coverage (76.00%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #13001 +/- ##
==========================================
- Coverage 91.67% 91.62% -0.05%
==========================================
Files 503 504 +1
Lines 27819 27888 +69
==========================================
+ Hits 25502 25553 +51
- Misses 1828 1844 +16
- Partials 489 491 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b9830b5 to
ac3a9f2
Compare
evan-bradley
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a good way to test the added functionality in this PR, or does it just feed into #12996 and we can test it there?
I think this should not make any difference, I was relying on the existing test suite, including the tests I added on #12998. We will see a behavioral difference with #12996 and we can test it further there |
5800834
Description
If we enable
DecodeNilas true, we may have untyped nils being passed. Unfortunately, these are not valid values forreflect, which leads to surprising behavior such as golang/go/issues/51649.Unfortunately, the default hooks from mapstructure do not deal with this properly. To account for this, we:
ComposeDecodeHookFuncfunction so that this case is accounted for the kinds of hooks that just won't work with untyped nilsThis should not have any end-user observable behavior.
Link to tracking issue
Attempt to work around #12996 (comment)
Working towards #12981