Comment by connicpu
1 day ago
You do what the compiler has to do under the hood: at the top of the function create a list of open files, and have a defer statement that loops over the list closing all of the files. It's really not a complicated construct.
No comments yet
Contribute on Hacker News ↗