Why you should learn Go in 2020
As the new year is about to come around, we all wonder a bit about what 2020 will bring. As with every year, it’s also interesting to look at what technology is out there and what would be interesting to learn.
But in such a vast ocean of technologies, how do you choose what to learn next? Do you need to know Rust, Nim, Go or Kotlin?
The past years, I’ve really grown to love Go, and I’ve been using it almost daily. Either at work, for open source projects, or side-projects such as workwithgo.com.
But why should you learn Go next year? Well, here are some reasons why I think it’s a good idea to pick it up.
Go is versatile
Almost no matter where your interests with programming lies, there’ll be a way to do it in Go. Personally I like to dive into projects when learning a language, and ideally the project is useful. In addition, I often hear that Go is a ‘devops’ language. So let’s dispell that myth. (It does do great in DevOps as well though!) 😃
So if you’re wondering where you can use Go or need some inspiration for what you’ll build.
Web backend
Go works just fine as a backend language where you might traditionally see Python(Django), RoR, Java, etc.. In fact, Go has some pretty powerful tooling for doing exactly this.
Json / XML marshaling and unmarshaling are build into the language and take 0 effort to get started with. Spinning up a http server is just a few lines of code, and handling requests is a breeze. And all this can be done perfectly fine without frameworks. (As mentioned, workwithgo.com runs on a Go backend and so far I’ve not used an external library apart from the Database driver).
There are are some frameworks you might want into later such as buffalo, but it’s not needed to get started at all.
CLI Tools
Command-Line tooling with Go is neat, the standard library is sufficient to start creating CLI tools. Considering Go by default does not have a frontend part, creating CLI tools is something you can get started on out-of-the-box.
MicroControllers
Go runs on microcontrollers! Well, ideally you’ll use TinyGo, but it’s still Go. This is a really fun thing to do with Go. When you see your code actually move something in front of you, it’s just a nice feedback loop for development. As long as it doesn’t fly your drone into a wall.
If you want to learn more about this, I suggest watching Gergely Brautigam’s talk at gopherconUK. It’s a bit more expensive to get into if you don’t yet have a drone though. But you can get microcontrollers relatively cheap to start hacking away.
Maybe you’re still in time to program your own christmas LEDs? 🎄
Web Assembly
Go is one of the few languages that can be compiled to web assembly with the default toolchain. You can also use TinyGo for this as well, but you don’t need to.
So if you’re curious to explore a new language and a new target platform, Go has you covered here as well. There’s a tutorial on github which you can follow to get a taste for WASM. I’ve played around with it a bit and it’s quite nifty — though there’s still some Javascript involved. It’s work in progress, but that’s more about WASM than about Go😅
Cloud Functions / AWS Lambda
Google Cloud Platform and AWS Lambda both have support for running Go code. (GCP should not really be a surprise I suppose 🤔). If you already have some code running in the cloud, you can start using small Go programs where you’d normally opt for e.g Python.
The beauty of this is that the code is well contained and doesn’t require a huge overhaul of your existing system. You can test the water with a simple lambda/function.
Anywhere you’d use Python
This is actually a quote from Ignat Korchagin’s talk at gophercon titled ‘Go as a Scripting Language in Linux’. Go feels like a scripting language and can be used as such without much hassle. Anyway, that is when you want to build small Go programs that work as *Nix programs.
When you want to run Go code as an actual script with a shebang line, it’s slightly more difficult. Ignat’s talk about how they solved this at CloudFlare is absolutely great though and just about 20 minutes long. I recommend this to anyone who’s currently using a lot of python scripts.
Go is growing
If you read this far, you know that Go can be used in quite a few scenarios. But still, Go is not unique in this regard. Why then should you pick up Go?
Go is a growing language hence learning it might offer you a job opportunity in the future. Some quite large companies have already adopted Go, such as Uber, Twitter, Netflix, American Express..
They have almost 2 million (estimated) users, so you will not be alone when learning Go. If you want to interact with us, maybe join the gophers slack. It’s a friendly, and growing, community with about 50.000 people at the moment.
People 💙 Go
According to the StackOverflow 2019 survey, the top 5 most wanted languages by developers includes Go.
In addition, Go also pays extremely well. Bringing in the second highest salary globally. A position it shares with F#.
It also just makes it into the top 10 most loved languages on StackOverflow of 2019, being in the 9th place, just above C#.
Go is fun
Yes, this is entirely subjective, but Go absolutely makes me have fun. Usually each year I use a mix of languages when participating in the Advent Of Code. But this year, it’s just been all Go (and a tiny tiny bit of Haskell because I love that too).
There’s a few languages that I think are fun just for the language itself regardless of what I do with them. It’s definitely sitting in my top 3.😉
The best way to see if Go is fun for you would be to just get started programming with it!
Getting started
Let’s say that I’ve convinced you to get started with Go, how would you go about doing this? Personally I’ve read “The Go Programming Language” by Donovan and Kernighan and quite enjoyed it as a good introduction to the language.
Furthermore, it’s probably a good idea to check out go.dev for information on how to install Go and learn more about the language. 😃