Member-only story
Starting with Go? Here Are 5 Things You’ll Be Glad to Know
A collection of five Go concepts to support your journey
Go has quickly become one of the most popular programming languages thanks to its balance of performance, simplicity, and ease of learning.
But like any language, some concepts can be tricky at first or simply not obvious when you’re just getting started.
In this article, I’ll share five things that I wish I had known at the beginning of my Go journey, which could help you to avoid common mistakes and enjoy a smoother experience.
Interface variables and switch type assertion
One of the strangest concepts when I started working with Go was that of the empty interface.
Although they allow you to receive anything as input, you still have to cast it to a specific type afterwards.
Handling all possible cases can be cumbersome, so I usually preferred different functions with concrete types to a single general function with interfaces and lots of conditions.
However, once I started to understand the power of Go’s interface approach, everything changed, and the switch assertion became one of the most useful things I had ever seen.

