3 ms·
Until you spawn a goroutine from a loop and suddenly you have to think about scope rules, nonlocal references, etc... (It doesn't bother me, just noting the s
by xyzzy123 3y ago
Until you spawn a goroutine from a loop and suddenly you have to think about scope rules, nonlocal references, etc...
(It doesn't bother me, just noting the same complexities do come up pretty often).
- nasretdinov 3y agoBTW this is actually being addressed, specifically the for loop now essentially captures by value instead of by reference. I believe no real working programs were affected by the change, except for maybe fixing bugs in them. Proof: https://go.dev/blog/loopvar-preview https://go.dev/blog/loopvar-preview