Top 5 Reasons Why You Should Learn Golang

Jayson Lennon
Jayson Lennon
hero image

Why Learn Golang?

If you think about it, web browsers are the new operating systems, while websites are the new globally available applications.

But in order to handle the massive traffic these applications generate, you need a capable language designed to handle this massive traffic.

Enter: Go.

Go (Golang) is a general-purpose programming language built by Google with a heavy focus on scalable, high-performance applications. It's an exciting language and I'm here to break down the top five reasons you should learn Go!

Wait a second! Aren't you the guy that also said we should learn Rust?!

Damn, you caught me. You're not wrong. I am a big fan of Rust and I did write about why you should learn Rust here.

But I'm also not dogmatic in my belief that there is "one programming language to rule them all". I'm a believer in using the right tool for the right job.

So stick with me. These are my top 5 reasons you should learn Go.

Reason #1. to learn Golang: First Class Concurrency

Go was designed by Google to handle their massive workloads, which as you can imagine, requires serving billions of requests. To facilitate this, Go has built-in support for concurrent operations through the use of goroutines and channels.

  • Goroutines are Go's way of managing multiple threads and in-flight requests.
  • Channels are used to communicate with goroutines.

Spawning a goroutine is done easily with the go keyword:

package main
import "fmt"

// Potentially expensive function
func fib(n int) int {
	if n <= 1 {
		return n
	}
	return fib(n-1) + fib(n-2)
}

func main() {
	// Channels are used to send data between goroutines
	answer := make(chan int)

	// Spawn a goroutine with the `go` keyword
	go func() {
		// Place the return value into the channel with an arrow
		answer <- fib(40)
	}()

	// The main function can continue processing while
	// fib(40) is calculating.
	fmt.Println("Calculating fib(40)...")

	// Take the answer out of the channel, when ready.
	fmt.Println(<-answer)
}

Goroutines can handle both high computational workloads and idle workloads, such as waiting for network requests. Both of these concurrent operations are abstracted away through the use of the single go keyword.

Go also provides additional concurrency structures such as Mutex and WaitGroups. These allow fine-grained control of concurrent memory accesses and allow you to easily manage all of your goroutines.

These structures, combined with the ease of creating goroutines, make implementing high-performance web applications a breeze.

Reason #2. to learn Golang: Performance

Go applications compile to a single binary that can be easily packaged and distributed to the target operating system. This makes it perfect for large-scale cloud deployments and great for K8s as well. Not having to ship an entire runtime makes the startup time of Go applications in the cloud much quicker than Node or Java applications.

Go programs compile straight to the metal. This makes Go run fast... really fast. Go is only outperformed by the C, C++, and Rust languages.

So expect your Go programs to be faster than any scripting language and most compiled languages such as C# and Java. And this performance is achieved with zero effort on the part of the developer.

Go, like many popular languages, implements memory management through a garbage collector, so you don't need to worry about keeping track of memory allocations. Go's collector is tuned for low-latency in order to perform consistently under many different workloads.

This makes Go the prime language for web developers who want to get more performance out of their applications and do so without having to decipher cryptic code or stumble through segfaults that plague similarly performing languages.

This leads us to the 3rd reason you should learn Go...

Reason #3. to learn Golang: Simplicity & Familiarity

Go was designed by Google to be simple and familiar, in order to help reduce bugs and for quick onboarding of new developers, with minimal effort.

If you've never coded before, Go is a great first programming language to learn. The vocabulary of the language is intentionally small and it doesn't have a complicated syntax. Since Go manages memory for you, there is no need to manually allocate and deallocate data. This allows you to focus on solving your problem without fighting the language and without needing to worry about the underlying details.

If you have programmed in another language before, then you will still feel right at home with Go. Go's omission of many technical or esoteric features found in large languages, like C++, make writing Go code feel more like writing a script in Python.

Go also features static typing with type inference, so you'll only need to provide data types in function signatures and structures. This makes Go code very concise and easy to read, and gives it the ability to catch some errors at compile time instead of at run time.

Reason #4. to learn Golang: Package Manager

Package managers are the new normal for modern programming languages. Go is no exception. Go's package manager allows you to easily add functionality to your application with a single command:

go get <url>

Go will take care of resolving dependencies, downloading and installing the necessary packages, and making sure everything "just works". And the Go tooling is smart enough to detect when you are using specific packages in your code, which will automatically add appropriate imports when using an IDE.

Creating your own packages is even easier: if your code is on GitHub, then it's already a package!

Since the go tool pulls in dependencies from URLs, your package will be available as soon as you run go get. After that, the Go package repository will automatically index your package and periodically check for updates and even generate easily searchable documentation.

Reason #5. to learn Golang: Proven Track Record + Job Demand

Go has been in the wild for nearly 10 years. Even longer within Google walls. But Go usage isn't limited just to Google.

Go is also used by many companies such as Twitch, American Express, and Capital One.

Go's concurrency and speed make it especially prevalent with payment processors and streaming services since they have such extreme volume requirements.

Since so many companies across a wide spectrum of industries operate on the web and need to scale, there are over 20,000 job postings available for Go programmers. This is just the ones posted on LinkedIn in the United States. They also seem to make really good money with an average salary of $100,000 / year per ZipRecruiter.

So if you are looking for a programming language that's:

  1. Used to solve really interesting scaling challenges
  2. Is easy to learn
  3. Has good job opportunities
  4. Can provide generous compensation

... then I'd say that learning Go is a great option!

Why GoLang is awesome

Let's quickly recap.

First, Go's excellent support for concurrent programming makes it a top choice when working with web applications or high volume transactional systems.

Second, Go's high performance characteristics, combined with ease of use, make it the perfect language to use if you want to give your application a large performance boost without much effort.

Finally, Go's design is welcoming to both new and experienced software developers alike. This means you'll actually be able to learn Go and create high-performance applications in a relatively short amount of time allowing you to add a valuable and marketable skill to your resume and toolkit.

How can I learn Golang?

To start learning Go, here's a few options that I personally recommend:

  1. The free "Go Bootcamp" book by Matt Aimonetti, who's an active community member that has contributed to many projects including the Go language.

  2. The website go.dev is also a great free resource to learn from. This is where Google provides centralized and curated resources from across the Go ecosystem (including A Tour Of Go, which is a great place to start).

  3. The website Go by Example provides a hands-on introduction to Go using annotated example programs.

And one final biased recommendation! I just released a brand new course, Go Programming (Golang): The Complete Developer's Guide. My goal is to make learning Go fun and interesting. I teach students how to code & build real-world applications using Go from scratch, including a Final Project where you create an awesome Pixl art editor that's sure to impress employers as part of your portfolio.

I cover everything from the basics for complete beginners, all the way to advanced topics for more experienced developers.

I'm not much of a sales person but here's why I think you won't regret it:

  1. You'll get to learn by actually building cool real-world apps
  2. You'll get to learn alongside 1,000's of fellow students (and myself!) in our active online community on Discord
  3. We have a 30-day money back guarantee, so you've got nothing to lose!

You can also try some of the lessons for free, just click any lessons with a Preview button.

Want me to write more posts like this one? Send me a message on Twitter and tell me what you want me to write about.

More from Zero To Mastery

[Full Guide] Learn To Code For Free in 2024 & Get Hired in 5 Months (+ Have Fun Along The Way!) preview
Popular
[Full Guide] Learn To Code For Free in 2024 & Get Hired in 5 Months (+ Have Fun Along The Way!)

Updated for 2024 (including A.I. & ChatGPT). In 2014, I taught myself how to code & got hired in 5 months. This is the step-by-step guide I used. Now 1,000s of other people have also used it to learn to code for free & get hired as web developers.

The 6 Mistakes I Made When Learning To Code (And How To Get Past Them) preview
Popular
The 6 Mistakes I Made When Learning To Code (And How To Get Past Them)

This article will help you save time and avoid the mistakes that a lot of beginners make. If I could go back in time, this is how I would have saved myself from countless hours, days, and months working on the wrong things.

Getting Hired by Amazon as a Software Developer with a 2.9 GPA preview
Popular
Getting Hired by Amazon as a Software Developer with a 2.9 GPA

Part of our Zero To Mastery Student Interview series, we speak with Justin Lin about how Zero To Mastery helped him land internships with JP Morgan and Amazon and what advice he has for others that want to do the same.