I already noted that in my very first post, "How do I clean up? As I said, 
the app does not persist (so I can't defer os.Remove)"

I guess I wasn't quite clear about my intentions, so never mind, I'll just 
handle it somehow. 

Thanks all for your suggestions.

On Monday, 21 November 2016 16:57:56 UTC, Val wrote:
>
> OK, I had overlooked the fact that cleanup is important to you, which 
> makes sense for security and to save disk space early.
> TempFile, TempDir don't do the cleanup, but the OS will sooner or later.
> Here is my new suggestion for a file 
> <http://www.programming-idioms.org/idiom/138/create-temp-file/1751/go> 
> and for a dir 
> <http://www.programming-idioms.org/idiom/139/create-temp-directory/1757/go> 
> :
>
> tmpfile, err := ioutil.TempFile("", "")
> checkerr(err)
> defer os.Remove(tmpfile.Name())
>
>
> dir, err := ioutil.TempDir("", "")
> checkerr(err)
> defer os.RemoveAll(dir)
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to