Things I love about Golang

Having written software in a variety of programming languages over nearly 30 years, I feel as though I've figured out where I like to apply different languages. Whenever I build something that involves front-end dev, for instance, I'll make sure I use TypeScript as far as possible. When I need to script something or do complex scientific/numeric calculations, I'll use Python.

When it comes to building back-end components for production applications, my go-to languages are Golang, Rust, Kotlin, Java and C (in order of preference at the moment, depending on the constraints of the environment in which I'm working).

Some of the things I really love about Golang in particular:

  1. Its syntax is fairly simple. This results in cumbersome code when trying to express something complex, but makes for easily readable code. (Rust, by comparison, allows for greater expressiveness in its type system and better compile-time correctness guarantees, but can result in code that can be really difficult to read.)
  2. Its standard library is extensive, allowing you to get a useful application up and running fairly quickly. This allows you to:
    1. Worry less about critical open source dependencies eventually ending up unmaintained.
    2. Write code that only really needs to change as business requirements change if you don't depend on too many external libraries. Standard library deprecation warnings are also kept in place for a very long time before that code is finally removed.
    3. Write unit and integration tests fairly easily.
  3. Its language stability and backwards-compatibility guarantees allow you to not have to worry about surprise breaking changes in new versions of the compiler or standard library.
  4. Its source-based dependency management strategy allows one to avoid certain classes of vulnerabilities. For instance, in some ecosystems, like Rust, Python and JavaScript, there's no guarantee that the artifact in the centralized artifact store (e.g. the package you get from crates.io, PyPI or npmjs.com) corresponds to any particular state of the open source code repository. With Go applications, you're guaranteed by way of the checksum of a dependency that you're getting the code in the repository at that commit.
  5. It has a fairly strong community, judging from how many long-standing, well-maintained open source libraries and applications there are in the community. Combining this with its simplicity and its extensive standard library, this makes Go a great language for rapidly prototyping back-end applications that can eventually end up in production.
  6. Concurrency is effortless. Compared to Rust's async approach, Go's concurrency approach and built-in runtime allow you to not have to think about it too much. (Some downsides to this, of course, are that it's more difficult to configure, and Go's concurrency is easy to abuse, so it still needs to be used with caution.)
  7. There's great open source tooling available for it that helps you write better, more secure code, like golangci-lint and govulncheck.