Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

/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.



> 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


Thanks for the clarification, and the link :D




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: