Currently I am storing a map with key being a Struct (MyIntC). I would like to retrieve all the key in the map as a slice. The slice will be pointer to map key. This is so there is no copy of multiple key.
When I tried in here (https://play.golang.org/p/bclmCh_YV5), it is not working.
All elements in the slice will point to the last map key element iterated.
Why is that so? How could I overcome this?
Note: I suspect it is very similar issue to Slice of structs vs a slice of pointers to structs, in which I am always using the local variable address.
Thanks.