I’m starting on a Go project for the first time in a while, and a few people have asked me how to starting writing Go. The last time I spent a significant amount of time writing Go was over a year ago, so while I also needed to refresh my knowledge, there have been a few new things released since.
I learn best in two phases: first reading a lot about a subject and then building something with it. The project itself is the last bit, but going into it I want to be as ready as I can to hit the ground running. That all said, what I read is essential. I don’t find programming books which walk through things like type primitives in great depth remotely engaging — I want to know just enough to be productive.
I’m assuming that you’re coming from the position of already being confident with a programming language and testing. I don’t think I’d start with learning Go from the beginning.
Learn Go with Tests
Learn Go with Tests provides a lovely introduction to the basics of Go while taking you through test-driving what you’re learning. This is the first time I’ve seen this approach, and I’ve found it’s helped me get back into the language itself.
Go in Practice
Once you’ve got an understanding of the basics of Go and have written a little, I’d recommend Go in Practice. It’ll run through some common things you’ll need to do and expose you to some patterns as you go. You might well find you can use the examples mostly as-is, which I find helps in making it feel like you’re making good progress in building something.
I read this cover to cover, but you don’t need to do that. I find once I have, it’s much easier for me to pick the book up and refer to something I then need.
Ultimate Go Programming Course
Once I’ve built a few simple projects, I then want to go into some more depth on how to structure more complex applications. I find this sort of depth doesn’t help until much later on and watching a video course helps keep me engaged.
I’ve been finding Bill Kennedy’s Ultimate Go Programming fit this well, he’s an engaging teacher and the depth is just right.
If you have an O'Reilly subscription, you can find it there.
And notes and slides on GitHub.
Go by Example
Finally, something I refer to regularly that’ll help fill in some gaps. I jump to Go by Example when I broadly know what I’m trying to do, but can’t quite figure out how to do it in Go.
It’s how I solve something like: “I need to read a file …how do I do that?”