Is there something like finally() in Go just opposite to what init()?
Is there something in Go which do just opposite to what init() do inside a package? icza This was discussed before by the Go team, and the conclusion was not to add support for it. Quoting minux : Personally, I prefer the style where program exit is handled exactly same as program crash. I believe no matter how hard you try, your program can still crash under some unforeseen situations; for example, memory shortage can bring any well-behave Go program to a crash, and there is nothing you can do about it; so it's better to design for them. If you follow this, you won't feel the need for atexit