Getting Going With Go (Golang)

Or why the future of my code is statically typed and compiled. Note: Extreme nerding to follow. Not applicable for “Bros”, “okes” or “chinas”.

I've spent the last few months finally diving headlong in Go. While I’ve installed it and looked through a tutorial or three over the last few years, I’ve not made a commitment until recently.

Why Go (Golang)

I’ve done the majority of my work on the server side over the last few years with nodeJS, whether its a standalone application or a set of serverless functions, it’s been a solid go-to for quite a while.

That said, finding odd, hard to solve and test bugs at runtime gets old, along with dependencies on, and the overhead of, a runtime, and the very tiring rapid evolution of a language that's really only just beginning to find its feet with the post es2015 javascript era upon us.

taking a step back, one could make a fair argument, that JS, node, and its eco-system are not production ready.

Creating projects with hundreds of dependencies, for even a simple application, I find myself spending an inordinate amount of time setting up each new project, for fear that the dependencies we rely on for some modicum of sanity have moved on yet again. Despite a huge community, myself included, spending years running all of this in the wild, taking a step back, one could make a fair argument, that JS, Nodejs and its eco-system are not really production ready. (🔥 🔥 🚒)

While static typing and compilation may seem like a burden when you’re coming from JS land, the benefits it bestows on your code are undeniable. Not only is the compiler your friend ensuring everything works as expected, but types bring a clarity to your code, that's almost zen-like. Furthermore, being able to compile binaries for multiple architectures, that run without needing a runtime or VM is liberating.

Beyond the softer experiential aspects I mentioned, Go is terse, and approachable, radically outstrips node and many other languages with regards to performance, putting powerful tools such as easy to reason about concurrency, and parallelism at your fingertips. Not to mention an incredible standard library, and builtin tooling that’ll give your productivity a serious boost and burn down that old bike shed once and for all.

Packages, Packages, Packages

Node has many conveniences and certainly has its place. Though, while the eco-system around it is an incredible strength of node, its also a curse. Go also has a strong eco-system and growing community, but the overall quality of open source modules, tools and micro-frameworks is quite a bit a higher, I believe, due in part to the exceptional code-quality tools built into the language, and the kinds of developers that it seems to attract.

As the language make linting, testing, documenting and benchmarking your code incredibly easy, the community has a keen focus on code quality and seems to frown somewhat on these not being present in a project for public consumption. This, I think, is a great cultural trait in the community that helps junior and senior developers alike.

Beyond a great open source eco-system and growing community, go’s focus on the “package paradigm”, makes writing and orchestrating, well tested (truly) micro packages and programs the obvious architectural approach. This gets us, almost for free, that all too elusive highly modular and reusable code, directed by the conventions of the language.

Where did it come from?

Go was developed at Google, circa 2007, uncoincidentally just after the release of the first multicore processors. It was designed to solve many of the challenges of engineering at scale that Google faced, as well as take advantage of the next wave in chip technology. Go was open sourced in 2009, and reached v1 in 2012.

As Todd McLeod puts it, the team behind the Go programming language are “luminaries” of computer science, including Robert Griesemer, Rob Pike and Ken Thompson, who are collectively responsible for some critical innovations and technology such as the Unix OS, various programming languages, and UTF-8.

find out more about the origins of the Go programming language at https://golang.org/doc/faq#Origins

Going, Going, Gone?

Unlike many who’ve written similar opinion bits about their first encounters with Go, I’m not leaving node or es6 behind. Instead, I’m adding a powerful tool to my bag of tricks.

I wrote this because this encounter has had a profound effect on me, and Go lives up to the hype. If you’re in the market for a new all-purpose programming language, I hope this will inspire you to consider Go.


Sigma Digital

My name is Paul van Zyl. I’m the principal consultant at Sigma Digital, a small specialised, decentralised product design and development team. If you’re looking for a partner who can actually deliver on your next innovative project, help you and your team up your game, or just want to say hello, get in touch here: paul [at] sigmadigital.io