Today I want to talk a bit about Go - the programming language, not the board game. I want to talk about why I think some features of the language and its ecosystem are great for cloud engineering work, and also what could improve.
Enjoy!
Benefits of Go
The creators of Go intentionally designed it to be a language that should be relatively easy to learn and work with. Google made Go, which is used for many popular cloud software tools such as Docker, Kubernetes, Pulumi, Terraform, and others.
There are a few reasons which I think make Go a very interesting language:
- Small language. There is a limited set of features in the core language itself. It is thus relatively easy to learn and keep in your head.
- Great bundled tooling. The bundled go tool has helpful features for testing, documentation, code checking, and formatting. It is all there, no complex process of installation and set-up.
- Fast compilation. Go is a compiled language, but the compilation is quick. You can compile and run code without worrying about delays, most of the time.
- Simple deployment. Go programs compile to a single binary, which makes it easy to deploy. No complex runtime environments to set up.
- Compatibility. The designers of Go are very careful about not introducing breaking changes in the language. This makes upgrades of Go uneventful things. Go code that was written many years ago will probably still compile and run.
- Good community. You can find documentation and learning material for Go in many places, and I find people often being quite helpful overall.
Note that I have mentioned no features of the language itself here. Instead, most of these benefits are things that make the general life of maintaining solutions build in Go easier. For cloud engineering work with infrastructure and operations, I find this precious.
Of course, there are also language features that I think are nice, as well as missing features that would be nice to have.
Picking a language for cloud engineering
In my day-to-day tasks, I often engage with multiple customers, as well as internal teams. Some use Terraform, other use AWS CDK, or tools like Serverless Framework, or AWS Copilot. Those that use AWS CDK may use different languages as well.
Many of the languages and tools in place can be pretty ok, once all the bits and pieces are in place - and you spend at least 40-50% of your work week with them. The problems arise when you have solutions you only touch occasionally, because you seldom need to do any changes.
If there are complex runtime environments (compilers, build tools, testing tools, packaging tools, etc.) that can be painful to juggle. Setting up a specific in a docker container image may ease that pain, but can still be a lot of work. Not only the setup itself, but to re-learn all the different tools and options in place.
For example, I like both TypeScript and Python as languages, but not the complexities of the environments they need to run and maintain the solutions in. Go is much simpler to work with in that regard.
However, with tools like AWS Cloud Development Kit (AWS CDK) the experience with Go leaves a bit to be desired. When you work with AWS CDK, the primary language is Typescript (JavaScript) - all other languages are second class languages. The Typescript-oriented flavour of the tools is noticeable with Go. There are also very few examples for Go - even AWS own documentation lacks Go examples. Pulumi does a better job here. It’s not surprising that Pulumi does a better job here since it’s written in Go.
We will explore using both AWS CDK and Pulumi with Go in separate blog posts.
Learning Go
For programming and software development, learning by doing is a key aspect. There are many books and video courses for learning Go. Just reading or viewing video does not work though, instead you need to do stuff.
A few resources that I think are good are:
- Exercism - this website has learning tracks for many languages, including Go. You have some learning material for the language itself. They combine this with small and relatively simple exercises to learn different concepts of the language. Some prior programming experience is good, but you do not need to know Go before starting here.
- Learn Go with tests - This is an excellent website which teaches you Go by using Test Driven Development (TDD). You should have development experience in another language before starting this, but you do not need prior knowledge of Go.
- Gophercises - This is a free course which contains a few mini projects to learn specific concepts and areas of Go programming. You should have some knowledge of Go before jumping into this one.
- The main Go website has A Tour of Go, plus references to multiple tutorials and guides.
I am a big fan of Learn Go with Tests and I also like Exercism. A word of caution - if you have a tool like GitHub Copilot or AWS CodeWhisperer active, it may be too helpful for you to actually learn sometimes. Consider turning them off, if you have any of them active normally.
Last, I also want to mention the Go Playground. It is a useful place to try out small snippets of Go code, and it is also very useful to share code with others. For example, if you run into a problem and want to ask for help. It will be much easier for people to see the code that is not working and try it out themselves with a shared code snippet via the Go Playground.
Parting thoughts
Using a programming language is much more than just the specific syntax and features of the language itself. That is good to keep in mind when picking a specific language for a task, be it Go or another language. For cloud engineering related work I think Go is a quite good option to consider.
You can find the contents of this bulletin and older ones, and more at Cloudgnosis.org. You will also find other useful articles around AWS automation and infrastructure-as-software.
Until next time,
/Erik