4 tips for learning Golang


**NOTE-Tilt your smartphone for better view

1. Don't skip the fundamentals

While you might be able to get by with copying code and hunting and pecking your way through early learnings (who has time to read the manual?!?), Go has a very readable language spec that was clearly written to be read and understood, even if you don't have a master's in language or compiler theory. Given that Go made some unique decisions about the order of the parameter:type constructs and has interesting language features like channels and goroutines, it is important to get grounded in these new concepts. Reading this document alongside Effective Go, another great resource from the Golang creators, will give you a huge boost in readiness to use the language effectively and properly.

2. Learn from the best

There are many valuable resources for digging in and taking your Go knowledge to the next level. All the talks from any recent GopherCon can be found online, like this exhaustive list from GopherCon US in 2018. Talks range in expertise and skill level, but you can easily find something you didn't know about Go by watching the talks. Francesc Campoy created a Go programming video series called JustForFunc that has an ever-increasing number of episodes to expand your Go knowledge and understanding. A quick search on "Golang" reveals many other video and online resources for those who want to learn more.
Want to look at code? Many of the most popular cloud-native projects on GitHub are written in Go: Docker/MobyKubernetesIstiocontainerdCoreDNS, and many others. Language purists might rate some projects better than others regarding idiomatic-ness, but these are all good starting points to see how large codebases are using Go in highly active projects.

3. Use good language tools

You will learn quickly about the value of gofmt. One of the beautiful aspects of Go is that there is no arguing about code formatting guidelines per project—gofmt is built into the language runtime, and it formats Go code according to a set of stable, well-understood language rules. I don't know of any Golang-based project that doesn't insist on checking with gofmt for pull requests as part of continuous integration.
Beyond the wide, valuable array of useful tools built directly into the runtime/SDK, I strongly recommend using an editor or IDE with good Golang support features. Since I find myself much more often at a command line, I rely on Vim plus the great vim-go plugin. I also like what Microsoft has offered with VS Code, especially with its Go language plugins.
Looking for a debugger? The Delve project has been improving and maturing and is a strong contender for doing gdb-like debugging on Go binaries.

4. Jump in and write some Go!

You'll never get better at writing Go unless you start trying. Find a project that has some "help needed" issues flagged and make a contribution. If you are already using an open source project written in Go, find out if there are some bugs that have beginner-level solutions and make your first pull request. As with most things in life, the only real way to improve is through practice, so get going.
And, as it turns out, apparently you can teach an old senior developer new tricks—or languages at least.

Post a Comment

0 Comments