|
|
|
|
|
by knorker
3105 days ago
|
|
I don't feel that it's in more poor form than the solution suggested in the article: for i := 0; i < 3; i++ {
defer func(i int) {
fmt.Println(i)
}(i)
}
This shadows `i` pretty much the same amount as what I wrote. If `i` gets a different name inside the lambda, then it'd also be worse because then you could accidentally use `i` still. |
|