for k, m[k] := range m {...}
-j
On 8 Jul 2016 12:19 a.m., "Jan Mercl" <0xj...@gmail.com> wrote:
>
> I did not expect the result I've got: https://play.golang.org/p/ECno0PVdBF
>
> It seems like a bug to me.
>
Looks fine to me. The k in m[k] is the value of k before the assignment.
So the value at m["foo"] is assigned to m[""] and the value at m["bar"] is assigned to m["foo"]
-j
foo
bar
map[foo:314 bar:42]
I can't think of a valid explanation for that behavior.--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.