Hacker News new | past | comments | ask | show | jobs | submit login

The single example given here is incorrect. Since Go 1.22 loop variables have per-iteration scope, the "broken" code is deterministic and correct.

https://go.dev/blog/loopvar-preview




Outdated I'd rather say :) I documented here https://100go.co/#not-being-careful-with-goroutines-and-loop... but you're right, it was fixed (alongside 2 other mistakes in the 100).


I still need to support Windows 7 in my industry. The last supported version is 1.20. Outdated is relative.


I wrote some code today and I relied on the new behaviour. I felt a little dirty.


That was an issue in 2023? Quite sure C# fixed something similar back in 2012. Is Go still proudly reinventing the wheel, wooden and filled with termites?




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: