3 ms·
"else" for the happy path is part of the problem.
by deagle50 3y ago
"else" for the happy path is part of the problem.
- neilwilson 3y agoGenerally 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.
- deagle50 3y ago> Then the 'happy path' is just the rest of the function. Right, and that's why it's bad.