3 ms·
As I was originally answering a question regarding whether it was normal to return errors or raise exceptions, and because I've read Dave Cheney and Rob Pike's
by anonfunction 11y ago
As I was originally answering a question regarding whether it was normal to return errors or raise exceptions, and because I've read Dave Cheney and Rob Pike's blog posts explicitly stating Go does not have exceptions I replied as such.
However, after doing some research I learned that in addition to Panic() there's also Recover()[1], so I'll concede that there is similarity between panic/recover and throw/catch. Prior to my learning about Recover() I was under the assumption that Panic was just used to print a message and close a program with a non-zero status.
1. https://github.com/golang/go/wiki/PanicAndRecover https://github.com/golang/go/wiki/PanicAndRecover