Closed mimir-d closed 3 years ago
The linter is right, in this case we theoretically can get a panic.
Also may be it makes sense to put the whole content of the
for
to a separate function to avoiddefer
-ing in a loop. But this is a nitpicking. Feel free to ignore :)
I guess once can use inplace function for it:
for i := 0; i < runtime.NumCPU(); i++ { func() { ... defer msr.Close() ... }() }
i could've sworn i put that defer after the error check. fixing...
testing: