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.
One can just wrap os.Exit in a helper to get the expected behaviour.
An unresolved promise that causes other code to be skipped while program execution continues after the block is, well, unintuitive to say the least.
I certainly wouldn't mind if modern servers had something similar to make sure programs could stop gracefully. But then that doesn't help if you have a hardware failure...
[0] https://learn.microsoft.com/en-us/windows/win32/api/fileapi/...
[1] https://devblogs.microsoft.com/oldnewthing/20170510-00/?p=95...