Skip to content

Commit

Permalink
Fix implicit aliasing issue in nested maps
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamradhakrishnan committed May 8, 2023
1 parent 20b9845 commit a12cc5c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/deepcopy/traverse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
c.genDeepCopyIntoBlock(&namingInfo{typeInfo: mapType.Elem()}, mapType.Elem())
})
c.Line("(*out)[key] = outVal")
Expand Down

0 comments on commit a12cc5c

Please sign in to comment.