• FooBarrington@lemmy.world
    link
    fedilink
    arrow-up
    6
    ·
    8 hours ago

    As a passionate Golang hater, I can gladly explain!

    • It’s not just the repeated if err != nil, even though that’s already bad enough. But the really fucked up part is the := bullshit. It makes moving code around unnecessarily annoying, and it’s telling that few other languages share Golang’s approach.
    • The lowercase/uppercase rules for private/public stuff is theoretically not a horrible idea, but it makes the code look much more inconsistent. I find _ much easier to read, and this leaves upper/lower to signal other details. But I see that this is mostly personal preference.
    • Fairly basic operations take much, much more code than they should (e.g. deserializing JSON while handling extra args, or basic functional operations - though that should change sooner rather than later with the new generic methods, right?)
    • The decision to initialize every non-pointer primitive with the “bottom value” (or whatever it’s called again) makes sense in isolation, but it’s really unfortunate that they don’t support additive types, because this means a bunch of common tasks need to use pointers, and unfortunately the type system is worthless when it comes to preventing segfaults caused by bugs with pointers.
    • I find that most Go libraries have basically no documentation, if you’re lucky you get an example that might vaguely be related to whatever you want to know. I’ve had much better experiences in other languages.

    All in all IMO most Go code is 5x longer than necessary to actually express itself in a readable manner, all because the language still doesn’t have proper error handling or generic support (until recently at least). At the same time it’s fairly inflexible, the type system is still shallow and basic, and it’s still way too easy to shoot yourself in the foot.

    The only good thing Go has going is the single file deployments, but I’ll gladly spend one hour of every remaining day of my life setting up containers, if it means I never have to touch anything Go again.

    • SinTan1729@programming.dev
      link
      fedilink
      English
      arrow-up
      2
      ·
      7 hours ago

      Fair enough. I’m not a professional programmer, so I guess I won’t understand your frustration with long term maintenance of Go code. I do agree that it can be unnecessarily verbose. Writing something as simple as an http server takes a long time. Also, the dependency management sucks. It can’t seem to decide if it wants to be declarative or not.

      I do like that it’s dead simple though, and that the standard library has most of the basic stuff. I’ve mostly replaced the need for Python with Go, for small CLI apps. Nowadays, I only use Python when I have to use some specific library, mostly for mathematical computing.