How do I go about learning Go?
This year I had the privilege to organize GopherConIndia 2015 and also interview a number of Gophers.
A common question asked by all newcomers to Go is “How do I go about learning Go?” I posed the same question to these Gophers and here’s what they said:
Andrew Gerrand — First stop is the Go Tour. Then get Go installed and you must read the “How to Write Go Code” page. Then, check out the articles linked from golang.org/doc/ and the Go Blog in general. I like Go By Example for lots of clean examples of Go in action. There’s also the very nice Learn Go in Y minutes document, which walks through most of Go’s language features.
If you’re the kind of person who would prefer to kick back and watch some videos, try my “Code that grows with grace” and “A simple programming environment”, as well as Russ Cox’s “A Tour of Go”.
Cory LaNou — I get this question a lot. I think the answer is “it depends”. For experienced developers, usually reading Effective Go is enough to get moving. If you are new to development, this can be a longer process. I have mixed feelings about the “tour”. While I think it does a great job of showing off a lot of language features, I don’t think it does a great job in “building” up your skills in a manner that is conducive to actually learning the language. I have taught a couple of “Intro to Go” workshops, both to experienced and junior level developers. I’ve found that goes very well, and very little is “confusing” to any of the audience. Where people really get lost is when they start their first “real” project and haven’t been exposed to the idioms of Go, and, therefore end up writing their previous language (ruby/java/c#/etc) in Go. That turns out poorly. You can pretty much expect a blog post from everyone that does that about why “go sucks” after that. Now, I’m certainly biased here, but I think the best way to get a real jump on the language is to either attend a workshop, meetup, or find somebody that is willing to pair with you that is already experienced with Go. In the long run, like anything else, just continuing to work with the language is the only real answer.
Damian Gryski — I usually send people to http://dave.cheney.net/resources-for-new-go-programmers, since it links to lots of good introductory material. For individual resources, the Go Tour and Effective Go should be everybody’s first stops. After that, watching some of Andrew Gerrand’s presentations will give a good grounding in how to “think” in Go.
I guess I can plug http://gophervids.appspot.com/ again here too.
Dave Cheney — I am told that people learn in a variety of ways, so I can only relate my own experiences.
I’m an experiential learner and tend to show little interest for learning without a specific goal in mind. That said, when I do have a goal, I tend to engross myself in it, and that often leads to many diversions into related fields.
Although I’ve programmed in many languages throughout my life, I don’t consider myself a polyglot, preferring instead to focus on one language at a time.
I think this is the best way to truly understand Go and learn to work within its strengths, and weaknesses, rather than being distracted by the continuous choice of an array of languages.
In summary, my advice would be:
- Do the Go tour and read Effective Go (especially if you have a background in another language).
- Have a project in mind that you want to use Go for.
- Stick with it, in my experience, having mentored several dozen programmers joining the Juju team at Canonical, you’ll be productive in the language in a matter of weeks.
Gabriel Aszalos — I would recommend starting with the Go tour. Francesc and his team have done a great job with it and have spent a lot of effort making it an optimal learning experience. It shouldn’t be taken lightly, it has 100 levels (last time I’ve done it) and will take you some time. You should be up to speed with most aspects of the language by the time you finish it. Another must read is Effective Go and the blog articles on golang.org. You will also be presented with some additional resources prior to finishing the tour. The natural next step is familiarising yourself with the standard library.
Additionally, I’d recommend starting to read other key people’s code, such as the standard library, getting involved in discussion groups such as Google Groups or IRC and not generally being afraid to ask questions.
Jason Moiron — As something of a True Believer, I think that to get the best out of Go you have to have some degree of buy-in to the underlying philosophy. These are really exemplified by the official documentation resources, which are brief, comprehensive, and well written.
If you’re already a programmer, do the tour, read how to write go code, read effective go, write some go code (perhaps guided by the codewalks or the blog), and then read the spec, in that order. Having a such a concise, clearly written spec is a huge luxury.
Go is becoming established enough where people are picking it up as a first language. For them, Caleb’s Introduction to Programming in Go covers a lot of the standard beginning programmer material.
Levi Cook — If you’re an experienced developer:
- read Effective Go
- browse How to Write Go Code (and don’t resist the directions on code organization)
- scan the standard library package docs
- start coding!
Go will feel comfortable and familiar for most developers on their first day. Then you’ll hit your head because Go left some important things out you’ll consider essential. Have patience at this moment, the lack of inheritance, generics, etc. is not an oversight. It was all intentional and works out quite well in practice. At this stage, bring your design challenges to a friendly Gopher, online, through a meetup, etc. It’s a friendly community and you’ll find someone ready to help. Alternately, explore the standard library source. Look for something similar to your problem and you’ll find well written, idiomatic Go code behind the scenes.
If you’re a beginning developer, there are fewer resources right now, but don’t despair! Caleb Doxsey has an excellent book published for you at http://www.golang-book.com. Start working your way through this and attending your local meetups. The book references an older version of Go, but this won’t mess you up. The Go language is committed to stability and hasn’t changed any of the features Caleb built the book around.
If the DIY (Do It Yourself) route isn’t appealing, for both beginners and experienced developers, get in touch. There are a number of really good instructor-led training options, including gSchool, growing in the community and I’m more than happy to connect you with something that meets your goals.
Matt Aimonetti — I would obviously suggest reading my free and Open Source eBook on Go: it’s based on the amazing Go Tour. The content is freely available online and in downloadable format. The entire book content is available on a public GitHub repo so you can submit content edits/new content and fixes as you learn.
Then read and reread Effective Go over and over until you know it by heart. Besides that, the Go blog has a lot of insightful articles about the language and its usage. I also learned a lot by looking at Go Packages’ source code. Check how the team does testing, how the code is organized, what solution did they choose to address common issues. If it worked for them, it probably should work for you too.
Steve Francia — I think there’s a lot of great material available, especially considering how young the language is. I found the Go tour extremely helpful. I also learned a lot by reading through the source of the standard library, which not only shows you how to write Go, but the idioms as well. Lastly, I think there are a lot of great talks and tutorials given by the Go team and by the community. I gave a beginners workshop on building your first Go application at OSCON that would be a great resource for anyone learning Go. You can find it at http://spf13.com/presentation/first-go-app.