Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on A study of real world data races in Golang.
I'm trying to reproduce that in this play: https://go.dev/play/p/3wkkfN3bMfH
Based on the study, I expect that the final print would print `err final value err:bar, 2`, but it's `<nil>`. And it is because it uses the shorthand variable declaration, which will make it to be in the scope of the go function closure.
Am I missing something?
There are no comments on this comment yet.
I'm trying to reproduce that in this play: https://go.dev/play/p/3wkkfN3bMfH
Based on the study, I expect that the final print would print `err final value err:bar, 2`, but it's `<nil>`. And it is because it uses the shorthand variable declaration, which will make it to be in the scope of the go function closure.
Am I missing something?