Top 3 Resources For Learning GoLang
Why Learn Go
If I were a system administrator looking to learn a new programming language it would be Go.
— Kelsey Hightower (@kelseyhightower) December 7, 2020
So many of our tools including Kubernetes, Prometheus, and Terraform are written, and extended, in Go that it’s almost a requirement next to learning Bash. https://t.co/OfZmGo4uP5
I know I am a bit late to the game here, with Go being over 10 years old, but the main reason I am learning Go is that it’s the language used here at Earthly.
Why should you learn Go though? The big reason is that the cloud world seems to be running on Go. Kubernetes, Docker, CockroachDB, Prometheus, etcd, Traefik, Istio, InfluxDB, and many more are written in Go.
Who This List Is For
“Before you learn Go, learn some C” – Alex Couture-Beil
This list is for experienced developers who want to learn Go. This is the list I am using to learn.
I’ve been a developer for over a decade and I’ve learned a lot of languages over that time. It’s something I really enjoy. If you are learning go just like I am, here are the top 3 resources I found in 2021 for learning it.
The list is shorter than I expected it to be, coming from Scala. I’m pretty certain some of Go’s success is due to that simplicity.
#1 A Tour of Go
“Honestly, for me I had a background in C, so simply going through various tutorials like https://tour.golang.org/list is how I learned.”
— Alex Couture-Beil
The first resource to recommend is the Go Tour. Titled “A Tour of Go”, it is an interactive exercise that takes you through learning the major features of Go. It includes some exercises, although maybe not quite enough for my taste.
It’s great because it gets you running and then writing code very quickly. You don’t need Go installed or even a text editor to start working through this tour and that low barrier to entry is really nice.
#2 Go by Example
“I found that hitting gobyexample.com when I needed practical examples helped a ton” — Corey Larson
After reading the tour, you’re probably ready to start playing around. If you have a side project, perhaps try reimplementing it in Go. If you’d like a more structured approach start with Codewars or Exercism.
Either way, writing, and running some actual code is a great way to build up familiarity. As you do this Go by Example is a great reference. Personally, I hadn’t written a C style for loop in a long time and I’m not sure if I had ever used the continue
keyword before. The side by side examples provided really helped cement things.
#3 Effective Go
Effective Go is next up. This document written by the language authors and explains a lot of the idioms of the language. It is dense but very informative. If you use a language enough, the syntax and semantics of it become second nature but I’m not there yet and for me, its very helpful to grasp the reasons behind some features. This backstory gives me a hook that helps strengthen my understanding.
Here is an example. As I was going through “The Tour” I was surprised when semi-colons appeared. All the examples had been devoid of semicolons and then all of a sudden they appeared in for loops and then nowhere else.
Effective Go explains that, like in JavaScript, the Go lexer automatically inserts semicolons using a simple rule.
if the newline comes after a token that could end a statement, insert a semicolon - Effective Go
I hadn’t seen semicolons yet because I hadn’t seen multiple statements on a single line. Learning this rule made thee syntax feel less magical and more internally consistent.
That is just one example of something I learned from reading this document. For someone who is an experience programmer, but a Go newbie, Effective Go is a treasure trove of insights.
Start Coding
4 strategies for learning a new programming language:
— Adam Gordon Bell 🤓 (@adamgordonbell) December 6, 2020
1. Use it in a fun side project
2. Use it in a fun side project
3. Use it in a fun side project
4. Use it in a fun side project
At this point, if you haven’t started building something using the language you probably should, but first make sure you read How To Write Go Code to learn how to organize your projects and invoke the compiler.
Bonus Resources
When I was looking for learning recommendations from my coworkers and on reddit there were a lot of great links shared. Here are some of the things on my future learning list.
Bonus #1 Go - The Complete Developers Guide
“[Go - The Complete Developers Guide] is a very approachable solid introduction to Golang.” - Eric Vallee
I’m a big fan of seeing people work. Seeing how people interact with their text editors, how they work with the compiler, and think about solving problems. If you have someone available to pair program with, this is a great way to go. If you don’t have that access then video courses are great.
Go - The Complete Developers Guide is by Stephen Grider and covers everything from setting up VS Code to channels and goroutines. I’ve not taken the course, but I am a fan of Stephen.
A lot of people ask me what language they should learn.
— MARCUS 🏴☠️ 🇳🇬 🇺🇸 (@marcusjcarey) June 17, 2020
>> Golang (Go)!!
100% the best language out to learn & build stuff.
Here are @udemy courses by the amazing @Todd_McLeod with discount codes.
Buy & take the learn to code Go & web programming ASAPhttps://t.co/kpW2rxmxiZ
Go Courses by Todd Mcleod are also highly recommended by people online.
A Bit About Udemy
At my previous employer, I had an all-you-can-eat Udemy package and I used it quite a bit. What I found was the quality of content on Udemy varies widely. Some courses are just not good. Some have good parts, but are padded out with extra or outdated content. If you are going to buy an Udemy course, see what is recommended by others or see if there is a previous author you like.
The Stephen Grider course its on my todo list specifically because I did Stephen’s Docker and Kubernetes course in the past and enjoyed it. I like his approach to teaching, which involves having you typing out and running code as you go.
Bonus #2: Distributed Services with Go
“For me the main motivator for learning go was that it was kinda like Erlang with regards to goroutines / message-passing concurrency model, but with none of the performance drawbacks.” Vlad A. Ionescu
Everything covered so far fits into the beginner and language intro category. But I mentioned at the beginning my interest in go was related to all the great cloud and distributed computing happening in Go. That is what got me interested in Distributed Services with Go by Travis Jeffery.
“Go has become the most popular language for building distributed services as shown by projects like Docker, etcd, Vault, CockroachDB, Prometheus, and Kubernetes. Despite the number of prominent projects such as these, however, there’s no resource that teaches you why or how you can extend these projects or build your own.” - Distributed Services with Go
At the time of writing the book is only in beta and I have only read the free 1st chapter but it looks like exactly the type of book I need.
Bonus 3 to N: More Resources
Web Resources
YouTube Talks
- Go Concurrency Patterns by Rob Pike
- Golang University 101 Playlist
- Golang University 201 - Intermediate Playlist
- Golang University 301 - Advanced Playlist
Lists of Resources
Go Books
Here are some great resources for further learning:
Take advantage of them to deepen your understanding of Go. And if you’re diving into Go, you might want to check out Earthly for efficient and consistent build automation. It could be a valuable tool in your Go development toolbox.