You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That is the point of the link. Ranges reuse the same variable for all iterations, and maps are reference types so your code all points to the same map.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
If play.golang.org has the latest release, then yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I am trying to flatten inner slice by attaching the outer slice, then reverse the output of flatten the outer slice by attaching inner slice
https://play.golang.org/p/YwYC3BYwfyx
Inner slices
Outer slice
[map[id:A inner:[map[id:1] map[id:2] map[id:3]]]]
Pivot Inner
[map[id:1 outer:map[id:A]] map[id:2 outer:map[id:A]] map[id:3 outer:map[id:A]]]
What did you expect to see?
Pivot Outer
[map[id:A inner:map[id:1]] map[id:A inner:map[id:2]] map[id:A inner:map[id:3]]]
What did you see instead?
Pivot Outer
[map[id:A inner:map[id:3]] map[id:A inner:map[id:3]] map[id:A inner:map[id:3]]]
The text was updated successfully, but these errors were encountered: