Worth mentioning you don't need the second _ variable in range
statements e.g. use:
for i := range items {
.....
}
vs:
for i, _ := range items {
.....
}
On 07/01/2019 02:24, [email protected] 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 [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.