How I have been learning Go
For the past couple of weeks I have been learning Go and I found some resources of which I think they are worth sharing.
Learn Go with tests: A practical approach to idiomatic Go
This was basically my main resource to get started with Go.
For me, learning is most effective when I get to code something that goes beyond the minimal basics needed for the current topic / concept. The reason for that is that I tend to overestimate how much I understood a new concept when it is presented with only a simple example. Oftentimes I realize that only when I need to use that concept in a broader context and then suddenly code breaks, leaving behind that feeling of confusion that makes me deep digger into the technical details revealing how much I really understood. For instance, A tour of Go would be such a minimal tutorial.
The nice thing about Learn Go with tests is that it also teaches you Test Driven Development (TDD), so it also gives you a very nice introduction on how to write Go tests (and benchmarks!). This was an aspect of the book I enjoyed most.
At the end you get to code your own web-server with a JSON API in a TDD way. So you have your application covered with unit & integration tests from the ground up!
Jon Bodner’s: Learning Go
This book was released only recently this year. Quoting from the book:
This book is targeted at developers who are looking to pick up a second (or fifth) language. […] The focus for Learning Go isn’t just how to write programs in Go; it’s how to write Go idiomatically. More experienced Go developers can find advice on how to best use the newer features of the language. The most important thing is that the reader wants to learn how to write Go code that looks like Go.
I stumbled on it because I was looking for a book that wasn’t released 2+ years or so ago. Go is a rather young, quickly evolving programming language, so I wanted to make sure to find a book that’s up-to-date as much as possible. Besides that, its focus on how to write Go code idiomatically drew my attention.
Effective Go
This is another resource that gives tips on how to write idomatic Go code. It’s online and for free.
It might seem a little bit daunting at first, because it’s rather long (don’t look a the scroll bar). However, every “chapter” consists of several short “subchapters”, like often really only a few, short paragraphs plus some code examples. So I set myself a really low goal: read at least one subchapter every day.
This realistic goal helped me to read it consistently until I read it completely. And many times I read several subchapters, which felt even more rewarding :P
Leetcode: Keep practicing the basics with code challenges
I find it quite effective to solidify basics of a programming language, i.e. the most important data structures and built-ins, by solving algorithmic problems with that language, because it keeps you repeating the fundamentals on a regular basis.
I tried to do this daily the first couple of weeks, because that was when I learned most concepts in a short period of time, and I realized I would forget them too quickly if I don’t use them on a daily basis.
It doesn’t have to be leetcode. It could be any page that provides you such problems. Alternatives I know would be hackerrank or project euler.