You could try something like this: https://github.com/richardwilkes/toolbox/blob/master/atexit/atexit.go
I think the discussion here has missed the primary reason I have such code in many of my programs: to cleanly shutdown when asked to terminate, either by CTRL-C or someone issuing a catchable kill command. - Rich On Saturday, February 20, 2010 at 9:29:08 AM UTC-8, David Roundy wrote: > > I've searched the package repository, and haven't found an atexit (or > rather AtExit) function or its equivalent... but it seems like it'd be > pretty painful to live without this functionality. Are there plans to > add this? It seems like a perfect complement to the new SetFinalizer, > so that we could use a bufio.Writer without worrying about calling > Flush(), just to avoid losing data. > > Am I missing something? > -- > David Roundy > -- 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.