Go logo

What I learned while learning Go

This year I had the need to automate some server functions. Specifically to spin up a new virtual server, download a docker container, download files from an S3 store, execute the docker container on the downloaded files, upload the output files back to S3, remove original file from S3 – and keep track of the progress and success state of each step.

While most if not all of the above can be accomplished with Python or even Bash Scripts, I preferred to have this in a type safe language and catch any errors at compile time instead of runtime. Go also compiles into a single binary, reducing the dependency size when deploying to a new server – which l matters when you are charged per MB transferred and per second the virtual server is online.

Go – or Golang which is the more “googlable ” term – has been on my radar for a while now, and there are a plethora or resources to learn Go including their own excellent documentation – so I am not going to bore you with that here.

What I WILL bore you with, is the stuff I learned while watching talks on Golang.

A lot of tech companies have embraced the ethos of Go and migrated some or even all of their systems to Go, so there is a lot of info available on their journey to leverage Go’s strengths. Because Go is a relatively young language, you get a lot of technical talks about relatively low level information – wich I don’t seem to find for other languages.

So even if you have no interest in Go, here are some talks that anyone in technical field can find interesting, and because Go source code is pretty readable it is easy to follow.

Docker and Kubernetes are both written in Go, and they power a huge portion of the web and back-end systems with the ease of deployment they provide. In this 2016 talk at Container Camp, Liz Rice shows the (basic) inner workings of a container, by writing a container from scratch in just 52 lines of go code!

Some excellent information on network ports, and how you can have multiple listeners on the SAME socket by using the socket option SO_REUSEADRR is presented here by Gabbi Fisher at the 2019 GopherCon. It also gives some insight on how Cloudflare – one of the best CDN providers – it leveraging Go.

And finally, some insights from one of the creators of Go, Rob Pike, in this Go Proverbs video which gives us some quick rules to live by for writing clean code. While a lot of these are Go specific, it does provide some insight on what to look out for to keep your code simple and maintainable.