|
|
|
|
|
by kiitos
691 days ago
|
|
> since Go 1.22, every freshly-declared loop variable used in a for loop will be instantiated as a distinctive instance at the start of each iteration. In other words, it is per-iteration scoped now. So the values of the i and v loop variables used in the two new created goroutines are 1 2 and 3 4, respectively. (1+2) + (3+4) gives 10. I think you are assuming more guarantees than are actually guaranteed. You have a well-documented history of making incorrect claims about Go compiler and runtime behaviors, so this isn't surprising. > since Go 1.22, you should try to specify a Go language version for every Go source file What on Earth?? Absolutely 100% not. |
|
It looks you don't understand the change at all.
The statement "since Go 1.22, you should try to specify a Go language version for every Go source file" is made officially, not by me.
> You have a well-documented history of making incorrect claims about Go compiler and runtime behaviors, so this isn't surprising.
The claim is totally baseless.
All my opinions and articles are based on facts. If you have found ones which are incorrect or which are not based on facts, please let me know: https://x.com/zigo_101.