The Path from Beginner to Go Expert
4 years ago, I couldn't even tell you what a Go routine was. Today, I'm shipping production grade systems that scale to millions of requests, all using Go. If you're new to my channel, my name is Melky. I'm a senior machine learning engineer over at Twitch. In this video, I'll replay all the checkpoints that took me from copy pasting snippets of code to writing idiomatic test-driven Go, so you can compress years of trial and error into this single watch.
So, the first thing is why did I even learn Go? And the simple answer is in 2021 I was hired at Twitch as a junior engineer. And prior to this I was just kind of a simple Python script kitty working for a machine learning startup. And I had no prior experience to Go at all. So I basically had no other option but to learn Go and get good with it if I want to keep my new job. And at the time the kind of salary that Twitch was offering was really life-changing. So it really forced me to really understand and get good with the language.
The "Effective Go" Epiphany
As I wrote more Go, I started to get used to pointers, static typing, and all that, but I still didn't feel like I was writing proper Go. I wasn't getting any better at it. It felt kind of dry, that I didn't like it. And I really just wanted to understand like the philosophy and the approach of Go because I was writing it so much and it just didn't feel like it was coming naturally to me. And this all changed when I came across Effective Go, an article that I talked about numerous times on this channel and over on my stream. And it comes from the official go.dev, the official documentation and when I read this it kind of snapped everything together for me.
A straightforward translation of a C++ or Java program into Go is unlikely to produce a satisfactory result. Java programs are written in Java, not Go. On the other hand, thinking about the problem from a Go perspective could produce a successful but quite different program. In other words, to write Go well, it's important to understand its properties and idioms. It's also important to know the established conventions for programming in Go such as naming, formatting, program construction, and so on so that programs you write will be easy for other Go programmers to understand. And it kind of tops it off here with this document gives tips for writing clear idiomatic Go code. It augments the language specification, the tour of Go, and how to write Go code. All of which you should read first.
But even after reading all of that, I came to conclusion that reading only does so much. I mean, I could continue reading all the textbooks and watching all these videos, but I still had to put everything now I learned into practice.
Project 1: Building HTTP Web Backends
And the best way to do that is to actually code. These are just some of the things I found that helped me kind of get better at writing Go code. And the first one is simple to complex HTTP service for my web backend. So basically I was able to write a front end using React and I had my separation of concerns with my entire backend written in Go and basically the only time they would communicate would be through the wire through HTTP calls: get requests, post requests, any requests like that. And so you can start with simple, with just kind of getting like a hello world, health checks, kind of doing a simple CRUD app and you can really evolve that into something much more complex like using OAuth systems or different protected routes, implementing your own middleware, using the context package to help you inject middleware-like properties, and so you can really take the concept of writing a CRUD app on your backend and really make it as complex as you need it to be.
The next things I really got into were CLI tools because you notice a lot of really popular GitHub libraries in Go are for the CLI, like Cobra or Bubble T, anything made by Charm. And so I wrote Go Blueprint kind of after becoming more seasoned Go developer. Before that I had another project that I called Rag, which was React, AWS, and Go. And it was basically like this very simple version of an SST deployment where it uses a Lambda with a Go runtime and a React front end. So you can deploy things for a production scale service. And so that helped me understand how to pass different flags, how to pass different states across my application through the CLI all the way up to the cloud using AWS.
Project 3: Designing gRPC Microservices
The third one was gRPC. You'll notice that you kind of hit this plateau with running backends for HTTP services in Go. And so I eventually moved into this microservice architecture. And sometimes with microservices, you really rarely do a client interacting with your microservice. And most of the time, you'll have a microservice communicating with another microservice. And so that introduced me to gRPC protocol and allowed me to explore different ways of writing different systems that now interact with gRPC between different microservices. And it changed my thinking from how a user or a client would send down a payload to a microservice communicating with another microservice passing down payloads.
Project 4: Scripting and Automation in Go
And the last one was just simply writing pipeline jobs and scripts using Go. The previous three got me to the point of using Go that I was getting faster writing pretty cheap, quick scripts using Go from Python, which was a language I used before for scripting. But now if I had to do something like go through a DynamoDB database and kind of remove corrupted rows of data, I could quickly do that using Go and even faster than Python. So, just using it as my go-to obviously made me better at writing it.
Essential Books and Courses for Learning Go
With all that being said, I still think there's great resources that exist that will make you a better Go developer. Some of these have existed for a long time and some of these are brand new. However, I still think if you get around to them, whether they're a textbook, course, or a video, they'll make you a better developer. And one of those is Let's Go Further by Alex Edwards. So this is really the go-to textbook on writing a Go backend for web applications. I read this three, four years ago and it was so informative that I still use some of the principles from that book today.
The second category of resourcing will go under testing. Writing tests with Go is actually very easy and pretty rewarding. And one of the good resources for that is Learn Go with Tests. It's an online textbook. It teaches you everything about testing with Go and it also just teaches you about different principles of the Go programming language. And another really good textbook I recommend for specifically learning how to write proper tests in Go is Writing an Interpreter in Go. You'll also learn a lot of cool stuff from this book by Thorsten Ball. But I also think that this does a really good job of test-driven development with the Go programming language.
And another really good textbook I came across recently is 100 Go Mistakes and how to avoid them. This is a really good kind of general overview of things to use and not use with Go. I love how it's so clean. There's actually the source code here for the community that the author made public and it's a really good resource on just quick kind of tidbits and understanding proper ways to write the Go programming language.
And I'm going to plug my own course here, the Complete Course for Building Backend Web Apps with Go by Frontend Masters. This is a course I wrote that took everything I learned from the previous resources plus my time at Twitch plus all the open source projects I created into one course that spans about eight and a half hours, and it shows you all the different aspects of writing a Go application from the data layer, the API route, testing, authentication, middleware and a bunch more, especially on how to structure your Go project.
Conclusion: The Power of Practice
So with all that being said, all of those aspects helped me become a better Go developer. I was able to identify things I was struggling with, but I knew there was kind of this glass ceiling on how much material I can absorb. And so I really put it into practice, but really the thing that helped me the most is being forced to learn Go at my job. I won't stand here and lie to you. But without that, I probably wouldn't have become such a Go developer, Go influencer.
But let me know what you guys think in the comment section down below. I hope you guys enjoy this video. As always, make sure you comment, like, and subscribe for more. And I'll see you guys in the next one. Peace.