of course It would give you same address for "v" every time, v is one variable and in every iteration of for / range new value is assigned to v but the address of v will remain same in its lifetime.
On Monday, January 7, 2019 at 12:08:59 PM UTC+5:30, Alex Buchanan wrote: > > https://play.golang.org/p/NnACN5fLPT3 > > I was taking the address of the for-loop variable ("&v" in the example > above) and was surprised to find that all my items pointed the same > address. I thought I had found most of the Golang gotchas by now, but this > is a new one to me. > > -A > -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.