5 ms·
> Usually this can be resolved by creating a new function and calling that from the loop. But frequently not. [etc.] For me this is the appeal of the language;
by vldo 8y ago
> Usually this can be resolved by creating a new function and calling that from the loop. But frequently not. [etc.]
For me this is the appeal of the language; I really prefer things confined and manually scoped rather than having things globally scoped which would cause a lot of debate just around that. You often have to think about what you want to expose and where, but that's a good thing in my opinion.
- cpuguy83 8y agofor _, f := range fs { func() { defer f.Close() }() }