User talk:Dchapes: Difference between revisions

 
Line 19:
:Not closing the file was a silly oversight. Also note that (at least on sane OSes) if the file doesn't need to be re-opened the file could be immediately removed while still open and being read+written to avoid the case where sudden termination (e.g. SIGINT) prevents simple cleanup/removal.
:However, I purposelessly avoided making the example too complicated, I actually liked the original that effectively just pointed out the relevant function, except that the function is explicitly documented as requiring the caller to remove the file so I felt adding that was important. I also wanted to demonstrate that the argument was used as a prefix for a random name and was put into a reasonable directory by default. —[[User:dchapes|dchapes]] ([[User talk:dchapes|talk]] | [[Special:Contributions/dchapes|contribs]]) 20:06, 29 December 2014 (UTC)
::Nice, except... log.Fatal terminates without running deferred functions. I'd be okay with just changing <code>log.Fatal(err)</code> to <code>log.Print(err); return</code>. &mdash;[[User:Sonia|Sonia]] ([[User talk:Sonia|talk]]) 22:34, 29 December 2014 (UTC)
1,707

edits