from Hacker News

Go runtime: 4 years later

by spacey on 9/26/22, 7:25 PM with 284 comments

  • by nu11ptr on 9/26/22, 9:57 PM

    I really like the engineering principles in general that the Go team uses, however, I just don't like Go. That isn't meant as a slight or anything other than simply my opinion. That said, I really like the idea of a simple language based on the sort of principles demonstrated here. The runtime seems really nice, I just wish I liked the language better (IMO: not expressive enough, needs better error handling, needs much better enums, needs pattern matching, has error prone C-style 'for', almost everything is statements not expressions, special comments are error prone, has nil pointers, etc.). In the end I think if someone were to write a slightly simpler version of Rust with the Go runtime it might be pretty neat. That said, I don't know what I'd want to drop from Rust so maybe I'm just fantasizing.
  • by geenat on 9/27/22, 2:16 AM

    Love go as a platform.. self contained binaries have been a miracle for ops..but have a few big hangups about using the language full time because of the sucky ergonomics.

    * No optional/named parameters. Writing a whole function per parameter for function chaining is excessive. This would not be difficult to add to the compiler (i've done it and have seriously considered using the fork) but it seems like the team is just stubborn about adding stuff like this.

    * No default struct values. 0 isn't good enough in real world scenarios.. have fun writing BlahInit(...) for everything.

    * Would be nice to get the question mark syntax for error handling. Error handling shorthand for if err != nil would also be very welcome.

  • by pbohun on 9/27/22, 12:53 AM

    I'm really grateful for everyone who has made Go possible and continues to make it better. Well done language design, extensive standard library, good tooling, and great documentation is something that's almost impossible to find despite there being a multitude of languages.
  • by tbrock on 9/26/22, 10:34 PM

    I am not a fan of new knobs like this. It reminds me of Java where you actually have to think about -xMx blah blah and setting it is a dark art. I would really prefer if we could somehow confer the memory limit from the container environment to go so this could be set intuitively at the container level without mucking about in the go GC internals.
  • by tomalaci on 9/26/22, 9:05 PM

    I have been developing in Go for several years and feel like I have seen most it can offer which is quite a lot for backend/networking systems.

    Besides its GC implementation that works very well most of the time, it also has simple but strong debugging tools to investigate how well you are handling memory allocation and CPU usage. Enforcing consistent coding style also makes it very easy to read other people's code and quickly contribute.

    My suggestion to others is to avoid prematurely optimizing memory usage (e.g. trying to do zero-copy implementations) and always investigate performance via these profiling tools Go offers (e.g. pprof). Very often Golang's compiler or runtime will automatically optimize code that may not seem to allocate optimally.

    There are still downsides but some of them are actively worked on:

    1. Generics are still lack-luster (... but good enough to start replacing a lot of boilerplate code and will improve later on)

    2. Error handling is still tedious (fortunately it seems to be their next big focus), it should take less code-space and have an option of stack-trace

    3. Stdlib logging is too simple, lacks levels and structured-logging-style (currently actively discussed: https://github.com/golang/go/discussions/54763)

    4. Low-level UDP networking is weak (soon to be fixed as they accepted this proposal: https://github.com/golang/go/issues/45886 ), this will become more important as we transition to QUIC protocol

    5. CGo (C interop / C FFI) is pretty bad performance-wise compared to other languages, it's OK if it is an I/O operation but anything C interop that requires low latency won't be running great

    6. Similar to other languages, nowadays there are growing external dependency trees (e.g. I always wanted to use testcontainers-go to make integration tests easier but man, have you seen the dependency tree you will pull in with that pacakge?), solution in my eyes is flattening and standardizing most commonly used packages but Go in particular is very opinionated regarding what is included in stdlib

    The above downsides mostly come from the background of creating distributed data pipelines and certain data collectors/parsers. For building API servers, I keep hearing it is a godsend in its simplicity, so your mileage may vary depending on the business domain you work in.

    I would be interested to hear other people's experience with Go, however!

  • by synergy20 on 9/26/22, 10:36 PM

    It is probably a bit misleading when so many say: 'golang is easy', it is not, it is as difficult as Java or other language, probably easier than c++ and rust, but definitely not an easy language.

    it makes great sense for network with concurrency, not so with real time or low resource devices to me.

  • by philosopher1234 on 9/26/22, 7:57 PM

    Some very impressive wins here. Makes one wonder how much better things are going to get in the next few years. All without needing to change my programs!
  • by nhoughto on 9/26/22, 9:27 PM

    I always thought go needed more GC knobs, good that they added this one and the strong reasoning behind it makes sense. Impressive go has got this far with just one knob!
  • by throwamon on 9/26/22, 8:16 PM

    Still yearning for an Ocaml-like language that uses the Go runtime.
  • by nwmcsween on 9/26/22, 9:05 PM

    Not trying to be inflammatory but has the pclntab taking ~30% for binary size been fixed yet? IMO it's a pretty severe design choice.
  • by BenFrantzDale on 9/26/22, 11:17 PM

    After being bitten by the overhead of Go’s GC, we stopped using it and went back to time-tested C++.