2 ms·
As others have said, it is highly discouraged by the community to use panics as control flow. Generally a panic means there's a serious bug somewhere - not jus
by NateDad 11y ago
As others have said, it is highly discouraged by the community to use panics as control flow. Generally a panic means there's a serious bug somewhere - not just that unexpected stuff happened, but the programmer actively is doing something wrong.
Any library that panics for reasons other than a programmer bug would never be used by the community. I read a lot of Go code and look at a lot of Go libraries, and I've never seen one that said it purposely panics in my 3.5 years of writing Go.
Compared to Java, C#, Python, C++ etc... where declaring your code panics is a perfectly normal and expected way to report errors.