Finally isn't bullet proof. If you execute a promise in a try block and it happens to end without resolving, the finally block will be never be executed. Fun stuff.
I think this is correct behavior.
``` async function run() { try { await new Promise(() => { // The executor function finishes, // but it never calls resolve() or reject(). }); } finally { console.log("cleanup"); } } ```
I never expect cleanup to be logged.
defer isn't bullet proof either. I think there's a linter about it and os.Exit.
One can just wrap os.Exit in a helper to get the expected behaviour.