Hacker News new | past | comments | ask | show | jobs | submit login

"else" for the happy path is part of the problem.



Generally in Go the error path is part of the if, which usually returns from the function. Then the 'happy path' is just the rest of the function.

If you end up with complexity at this point then it is time to refactor into several functions so the 'happy path' follows the standard idiom.

Consider it a Go code smell.


> Then the 'happy path' is just the rest of the function.

Right, and that's why it's bad.




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

Search: