3 ms·
In Java you can set an uncaught exception handler, so you can make sure exceptions are caught in child threads from the parent. In Go, defer blocks are only ru
by djha-skin 3y ago
In Java you can set an uncaught exception handler, so you can make sure exceptions are caught in child threads from the parent.
In Go, defer blocks are only run for the panicking goroutine. Other goroutines do not run defer, the program simply crashes.
- t8sr 3y agoSure, if the program crashes, all bets are off. That’s also true of any other similar exception mechanism. The fact that the program crashes on unhandled panic, rather than letting you install a default global handler, is a design choice that has nothing to do with how goroutines are implemented.