3 ms·
Cool product! This is fairly unrelated but since you've open-sourced your code (thanks!) I was just browsing around the 'cli' project and saw heaps of the follo
by dxhdr 11y ago
Cool product! This is fairly unrelated but since you've open-sourced your code (thanks!) I was just browsing around the 'cli' project and saw heaps of the following:
if err != nil {
stdcli.Error(err)
return
}
Is this idiomatic Go? It's just sprinkled everywhere and makes it hard to follow logic at a glance.
- mwmanning 11y agoExplicit error handling is part of Go. It's pretty common to see lots of conditionals in a Go codebase.
- bliti 11y agoI work with Go at my day job and that's idiomatic. It's not the most beautiful or readable language for sure. This does force devs to think about error handling. Although it's not that different from code littered with exceptions (like some Java codebases).
- decisiveness 11y agoNot sure how much it applies here as I haven't looked at the code, but the Golang blog has a good article that talks about how to "Simplify repetitive error handling"[1]. [1]https://blog.golang.org/error-handling-and-go https://blog.golang.org/error-handling-and-go