Re:Down the Golang Nil Rabbit Hole
by thwarted on Tuesday March 30, 2021 @02:55AM
(#26631836)
Yes, it is odd to pass the address of a local variable from the enclosing scope like this to a go routine.
[ Parent
| on HN ]
Well that's true in the sense that usually you'd just close over it, which is the classic broken case of closing over a mutable binding: https://play.golang.org/p/40FRmvhifBl
I assume GGP's contrived example is to show the underlying mechanics of the issue.