Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Defer is not run if another goroutine panics #14542
Please answer these questions before submitting your issue. Thanks!
This led to a real-life problem where I was running a process via
I am sorry but this is working as intended,
Thank you for the explanation.
There a lot of places where unexpected panics could happen. In other languages you could have a global try-catch block in main, which would definitely always run if something bad happens. Frankly I expected the defer-recover in main() to work like that.
Is there another mechanism to recover from such failures or is the only way to deal with it is to add defer-recover into every goroutine?
Thank you for your time!