3 ms·
Maybe something like the following would be more explicit: for i,x := range xs { go func(x) { fmt.Println(x) }(x) }
by morpher 13y ago
Maybe something like the following would be more explicit:
for i,x := range xs {
go func(x) {
fmt.Println(x)
}(x)
}
- singular 13y agoYeah that kind of approach is typically how you resolve this issue, coffeescript even has a neat wrapper around (function([args...]) { ... })([args...]) of do (args...) -> ... to make this less painful. Interesting how the go syntax makes it easy to explicitly pass in arguments. That is very nice.