4 ms·
/pedant hat on Technically, the language does support exceptions. That said, they're in the "please never use this, ever." /pedant hat off The spirit of your
by srpablo 13y ago
/pedant hat on
Technically, the language does support exceptions. That said, they're in the "please never use this, ever."
/pedant hat off
The spirit of your comment is right, however -- the wonky code resulting from error handling, just like the "compile error on unused vars or imports," is something most new Go users find jarring.
- dragonwriter 13y ago> Technically, the language does support exceptions. That said, they're in the "please never use this, ever." No, its not. The convention is that any use of panics within libraries should be internal, and that libraries' exposed interfaces should use error returns. [1] Use of panics internal to libraries, or use of panics within application code that is not creating a library for others to consume, is not discouraged. [1] http://blog.golang.org/defer-panic-and-recover http://blog.golang.org/defer-panic-and-recover
- srpablo 13y agoThanks for the clarification, and the link :D