4 ms·
> I thought one difference was that a panic in a goroutine kills the whole process Only if not caught. But in any case this still means that you need to write
by knorker 3y ago
> I thought one difference was that a panic in a goroutine kills the whole process
Only if not caught. But in any case this still means that you need to write exception safe code, because you don't know if the function you call will throw, and you don't know if the function calling you will catch.
> `panic` only accepts a string argument
No: https://go.dev/play/p/ZDKpybtxABL https://go.dev/play/p/ZDKpybtxABL
> catch-and-rethrow paradigm for Go panics
Probably because "you're not supposed to". You can.
- tubthumper8 3y agoThanks for the clarification on the panic function signature - I missed it when checking the spec but it's definitely in there and defined as taking `interface{}` https://go.dev/ref/spec#Handling_panics https://go.dev/ref/spec#Handling_panics