On Mon, 24 Apr 2017, at 12:06 PM, Kevin Conway wrote: > I'd say that recover() is not a problem but, instead, a symptom of > panic() being available to developers. I'd flip the title and say > panic() should be considered harmful. To quote from > https://blog.golang.org/defer-panic-and-recover :> > The process continues up > the stack until all functions in the > > current goroutine have returned, at which point the program crashes
The standard library uses panic in a couple of places to exit from deeply nested function calls, e.g. https://github.com/golang/go/blob/master/src/encoding/json/decode.go#L167 A while ago I wrote this usage up as a recipe: https://github.com/iand/gocookbook/blob/master/recipes/panic-for-deep-errors.md Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.