-
Notifications
You must be signed in to change notification settings - Fork 422
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 implicit aliasing issue in nested maps #810
🐛 Fix implicit aliasing issue in nested maps #810
Conversation
a12cc5c
to
a48b995
Compare
@@ -374,7 +374,8 @@ func (c *copyMethodMaker) genMapDeepCopy(actualName *namingInfo, mapType *types. | |||
c.IfElse("val == nil", func() { | |||
c.Line("(*out)[key] = nil") | |||
}, func() { | |||
c.Line("in, out := &val, &outVal") | |||
c.Line("inVal := (*in)[key]") | |||
c.Line("in, out := &inVal, &outVal") |
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.
Thank you a lot for the contribution 🥇
Could you please ensure that the change/issue is also covered with a test?
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.
Thanks for the review @camilamacedo86 I have added a nested map in cronjob_types.go and that fields and other fields are calling this new line. I hope that will cover as a test case. Can you suggest if I need to add test cases in other places as well?
a48b995
to
766a447
Compare
@vincepri @joelanford @camilamacedo86 gentle reminder for review |
Hi, just ran into this as well. Looks fairly complete to me and 2 months passed, so maybe a gentle nudge is fair by now. |
@vincepri @joelanford @camilamacedo86 gentle reminder for review |
Played a bit around with it. Works as expected /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sbueringer, shyamradhakrishnan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Two notable changes occurred with the generated deep copy code: 1. Removed obsolete build tags - kubernetes-sigs/controller-tools#828 2. Fix implicit for loop aliasing - kubernetes-sigs/controller-tools#810 Signed-off-by: Lance Austin <[email protected]>
Two notable changes occurred with the generated deep copy code: 1. Removed obsolete build tags - kubernetes-sigs/controller-tools#828 2. Fix implicit for loop aliasing - kubernetes-sigs/controller-tools#810 Signed-off-by: Lance Austin <[email protected]>
Fix #809
The PR fixes the implicit memory aliasing issue in autogenerated DeepCopy method when the field is a nested map.