this post was submitted on 19 Sep 2023
34 points (100.0% liked)

Golang

2220 readers
1 users here now

This is a community dedicated to the go programming language.

Useful Links:

Rules:

founded 2 years ago
MODERATORS
top 4 comments
sorted by: hot top controversial new old
[–] mrkite@programming.dev 7 points 1 year ago

So it's not really a problem with for loops, it's a problem with closures inside for loops.

[–] lightsecond@programming.dev 5 points 1 year ago (1 children)

As someone just learning Go, the current behaviour is really unexpected. I’m happy that they are changing it.

[–] bmarinov@lemmy.world 7 points 1 year ago* (last edited 1 year ago)

As someone with years of Go experience, this thing bites me or my team in the ass at least once every six months. Sometimes tests catch it, other times the tests get written after the fact and made to fit the implementation. Hilarious bug hunts ensue. I'm happy for this proposal moving forward.

[–] austin@programming.dev 4 points 1 year ago

Much needed change, I wish they made it apply for all go versions though