I've noticed that cmd/vet's rangeloop check, which warns you about binding to range loop variables in function literals which are launched with 'go' or 'defer', is more limited than I thought:
https://github.com/golang/go/blob/d5ad7793d610bddfb3e7e09b8dafa0b0837f0cb2/src/cmd/vet/rangeloop.go#L6-L9 <https://github.com/golang/go/blob/d5ad7793d610bddfb3e7e09b8dafa0b0837f0cb2/src/cmd/vet/rangeloop.go#L6-L9> > This file contains the code to check range loop variables bound inside > function literals that are deferred or launched in new goroutines. We only > check instances where the defer or go statement is the last statement in > the loop body, as otherwise we would need whole program analysis. > I don't understand why whole program analysis is necessary here. Why can't cmd/vet check each function literal declared within the loop's braces? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.