How to learn Golang

A 3 minutes story written on Oct 2017 by Adrian B.G.

image

I am still a newbie regarding Go, so read this post with a grain of salt. I will keep this article up to date as my learning journey will continue.

Warning: this article was written for a more seasoned developer, if this is your first programming language I suggest to take some programming and basic Computer Science courses, before learning Go, like Scratch and Khan Academy. If you are a DevOps and want to take some shortcuts there are other articles tailored to your needs.

Tour of Go 🏟

The Tour must be your first step, here you will decide if you ❤ or 💩 Go.

The tour of Go is a live coding tutorial built by the Go contributors, what can be better than this? It will take you trough the most Go concepts and features.

YouTube 📺

I prefer watching or listening instead of reading tutorials. It allows me to multi task, so I can study more while doing boring tasks like walking, washing the dishes etc.

I am curating a YouTube playlist with the best intro-level videos I could find. The first video from the playlist is a crash course (similar with the tour of go), the following ones dive into different aspects of the GO, focused on the differences between other languages.

RTFM 📚

No matter your programming experience you need to read the manual, especially the “Effective Go” section. Go has some pretty weird concepts brought from different programming paradigms. 99% of the “newbie” questions I see on chat are covered in the manual.

A straightforward translation of a C++ or Java program into Go is unlikely to produce a satisfactory result — Java programs are written in Java, not Go.

The manual will also tell you how to :

  • format your code
  • name things
  • what is idiomatic and not
  • how to structure your projects

A big plus of Go is the fact the core developers solved all this problems for us, allowing the developers to focus on their problems not on syntax and other details. Also Go is highly opinionated, reading the manual will save you time on the long run.

image

Courses 🗞

As an experienced programmer is redundant and painful to take programming courses, because they explain concepts I already know. Nevertheless I bought and took this course from Udemy and actually found it useful, it has some pretty powerful example projects.

I haven’t write system apps with pointers in over a decade, so this course was a nice welcome. Mastering Go Programming - Udemy

Code, code and code some more ✍🏾

Every hour or so of learning must be covered by some written code. Programming needs muscle memory, if you don’t write it you will forget it.

While learning I try to solve some real problems to, so I published some Go packages on GitHub: fast priority queues, concurrency patterns or porting bitcoin algorithms.

Communities 👩‍❤️‍👩

I like Slack so I joined the Golang nuts community. I ask questions when I get stuck and I learn from other #newbies issues.

golang-nuts

GopherAcademy - Conferences, Training, and Community

Other communities can be found at https://golang.org/help/

IDE ⌨

VSCode was great for me at the begining, now I use Goland, but no matter the IDE you choose I suggest activating the following features:

  • run unit test as a file watcher (at save file)
  • run fmt (format code) at save file
  • auto manage the import statements

Suggestion 💡

Now is a good chance to start writing unit tests (if you haven’t already) for your code and benchmarks. Go has builtin capabilities and recommends doing this tasks.

You have any advice or questions for me? You want to help me with a code review? Let’s get in touch.

Thanks! 🤝

Please share the article, subscribe or send me your feedback so I can improve the following posts!

I curate a list of articles, talks and papers for one/two times per month. They are mostly related to computer science, distributed systems, databases, Go, containers and Cloud solutions.

comments powered by Disqus