Hacker News new | ask | show | jobs
by bern4444 1339 days ago
> What I think I'd say about Go is that it's a simple "day 1" language and a complicated "day 2" language.

This resonates. I very much dislike Go's error handling model. Its overly simple and leads to exorbitant

    if err != nil 
checks all over the place. It clutters the actual business code and remains a clunky, leaky abstraction.

I think Go is a language designed for engineers who don't care to learn about more elegant solutions that come with more intricate semantics (Option, Either, Try etc).

It's get the job done inspiration is sloppy and poorly conceived.

1 comments

The big thing too, with the `if err != nil` pattern is that it's _good_ Go practice to do that, but it doesn't feel good to constantly be spamming a 3 line error check on every single statement.

I really don't like hopping into a codebase and seeing a 27-line function (uncommented, of course) with 21 of the lines being `if err != nil` checks

Plus go code seems to embrace as short of a name for variables as possible.

Have a parameter for an array of users? Call it ‘u’. Want to have a variable for a config object? Obviously call it ‘c’.

‘Idiomatic’ go code is bad code.