3 ms·
I cannot value if it is good or bad, but Go’s error handlig is really very verbose. On the one hand, it makes it quite easy to follow control flow but on the ot
by cygned 8y ago
I cannot value if it is good or bad, but Go’s error handlig is really very verbose. On the one hand, it makes it quite easy to follow control flow but on the other hand it’s annoying to see an if err != nil on like every other line.
- tshannon 8y agoYep, which really explains why Go went with it. The Go authors have stated that it's designed for code to be read more than it's written, so they add verbosity in favor of clarity.
- usefulcat 8y agoWhether that verbosity improves 'clarity' depends on what exactly you're most interested in seeing. If you primarily value being able to see the control flow for error conditions, then it does indeed improve 'clarity'. However, regardless of what you value, that increased 'clarity' necessarily comes at the expense of the readability of the non-error control flow.
- tapirl 8y agonecessary "if err == nil"s never do bad. I did found some Go code contains many unnecessary "if err == nil"s, however I think this is not the mistake of Go, it is just thant some Go programmers misuse them.
- deleted 8y ago[deleted]
- deleted 8y ago[deleted]