3 ms·
It's been a while since I wrote Go, but my worry used to be that linters wouldn't be able to follow cases that were just slightly more complicated than average.
by oconnor663 4y ago
It's been a while since I wrote Go, but my worry used to be that linters wouldn't be able to follow cases that were just slightly more complicated than average. Like if I open one file, yes, the linter will be able to tell if I don't close it. But if I put a bunch of files in a long-lived map, the linter isn't going to know that any function calling delete() on that map needs to be closing the files too. But in Rust or C++, this case is handled smoothly by destructors. (With maybe a little caveat about whether it would be better to catch any errors that might arise when closing the file.)