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

That's a feature not a bug. Go intentionally forgoes abstractions of that sort. I personally prefer well written Java exception handling, but often Java exception handling code is a bolted on afterthought. Go's approach is to make error handling something you have to think about for virtually every line of code, rather than a superstructure built around the code. This can feel slow and painful to write, but it guides the developer toward considering each error case individually, potentially resulting in more nuanced responses to errors. It also makes reading the code dead simple.


> Go's approach is to make error handling something you have to think about for virtually every line of code

But that doesn’t work, and you can’t handle every error at the place of its origin.


Seems to me like it does work, based on many successful projects using it. There's nothing that forces you to handle the error at the place of origin, you can pass it on like you do with exceptions. You just can't bubble it up multiple levels.




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

Search: