3 ms·
A study of real world data races in Golang
- Ajnasz 5y ago> 4.2.2 Idiomatic err variable capture. I'm trying to reproduce that in this play: https://go.dev/play/p/3wkkfN3bMfH 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?