top | item 43653001

(no title)

tyho | 10 months ago

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

discuss

order

teivah|10 months ago

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).

yndoendo|10 months ago

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

tyho|10 months ago

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

josefx|10 months ago

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?