If you’re starting a new project or a job that requires knowing Go, here’s an opinionated learning plan that will get you ready in a hurry. If you’re exploring Go out of idle curiosity, this probably isn’t the plan for you—there are plenty of excellent videos and conference talks with a better balance of entertainment and technical content.
Learn the Language
You don’t need a local Go installation to get started - you can learn the language and start writing code in your browser.
- Watch an hour-long talk by Rob Pike, one of the core authors, for a sense of Go’s goals and aesthetic.
- Do the entire Tour of Go and read How to Write Go Code.
- If you’re writing Go professionally, join the Gophers Slack and the golang-nuts mailing list. If that sounds like too much, at least join golang-announce.
- Install Go using your typical package manager. We’ll revisit this later.
- Install and get used to
gofmt, Go’s code formatter. Use it on all your code.
After those three steps, spend some time writing a bit of toy code.
Learn the Idioms
As a community, Go programmers tend to prefer strong conventions over freedom of expression. Before you start writing Go professionally, get acquainted with the community norms.
You don’t need to read these documents in one sitting, but you should read them…don’t just skim the headings and move on.
- As soon as you’ve read and written a little code, read Effective Go. This is canonical advice, and everything in it is widely accepted in the Go community.
- For authoritative but slightly less canonical advice, browse the Go team’s common code review feedback and their guidance on package names.
- Learn the common idioms for working with slices.
- Read some core material from the Go blog. Start with the overall approach to concurrency and error handling (including part two), then move on to Go’s take on try-catch-finally blocks.
- Unit testing is built into the language, so get familiar with the standard library’s testing package, sub-tests, the race detector, and how to measure code coverage.
- Documentation generation is also built into the language—familiarize
yourself with the comment
testable examples. Bookmark
godoc.orgpkg.go.dev, which serves documentation for the standard library and all open-source Go packages.
Learn the Details
Once you’ve picked up the basics and some common idioms, dive a little deeper.
- At this point, it makes sense to stop relying on your package manager’s Go distribution. Instead, use upstream directly—it’ll be much easier to test beta releases and debug on older compilers. I use Travis CI’s gimme script. It’s a plain shell script, and it’s the same script that manages Go versions in Travis builds.
- Learn the details of Go constants, strings, slices (part two), and maps.
- Grok some more advanced concurrency patterns, including pipelines and cancellation.
- Gophers solve lots of problems by generating code, so read a little about
- Try profiling a running program.
- Read about the design of the garbage collector.
- Browse a bit of the language specification. It’s very readable, so don’t be afraid to consult it if you have specific questions later on.
If you’re done with all that and still want more material, work your way through The Go Programming Language and take Bill Kennedy’s Ultimate Go class. Both resources are long but worthwhile.