I created a map:
l := make(map[*A]string)
where A is:
type A struct{}
Then added key-values into it:
a1 := &A{}
a2 := &A{}
a3 := &A{}
l[a1] = "a1"
l[a2] = "a2"
l[a3] = "a3"
I expected to see all values ("a1", "a2", "a3") while doing range
for k, v := range l{
fmt.Println(k, v)
}
But I see only the last one.
Why that happens? https://play.golang.org/p/GSdUWzExxLK