Backend••10 min read•13 views

Why Should You Learn Go Now?

This language focuses on three main philosophies: simple syntax (simplicity), very fast compilation times to binary form (fast compile), and very light handling of parallel processes through Goroutines (concurrency-first).

Lately there's been a lot of buzz on your timeline LinkedIn or GitHub: Go, or what we more often call Golang.

As a developer who may be busy right now juggling between JavaScript frameworks that change trends every month, or stack PHP and Python are sometimes confusing when it comes to scaling and concurrency, you must be wondering why so many big companies are starting to migrate to Go. Why suddenly the language of the land gopher mascot has become a kind of "secret weapon" for building a resilient backend system?

Today, I want to give you a complete picture of Go. No need to worry about theories that are too academic. Let's examine it from the point of view of engineer to engineer: where did this language come from, why was it designed in such a way, how does it stand when compared to other languages that you already know, how long should you actually (or shouldn't) use Go in your next project.

Just relax, let's start from the beginning of the story.

Brief History: Born from the Frustration of the 'Tempers' at Google

If you want to know why a programming language has certain features, you have to look at who created it and what problems they were facing at the time. Well, Go was born from high levels of frustration.

Imagine you worked at Google around 2007. The scale of their system was crazy. Millions of lines of code, thousands of servers, and they use C++ and Java for most of their infrastructure. What's the main problem? Super long compile time. Imagine, these top engineers can spend tens of minutes, even hours, just waiting for the code to finish inbuild before it can be tested. The development cycle is super slow.

Finally, three computer 'temps' got together and decided to create a new language. They are not random people. There are Rob Pike (one of the designers of the Plan 9 and UTF-8 operating systems), Ken Thompson (a living legend who designed the Unix operating system and the B language, the predecessor of the C language), and Robert Griesemer (who worked on the V8 JavaScript engine and Java HotSpot).

The three of them sat down together and agreed to create a language that had to compile quickly like C, but was safe and had garbage collection features like Java, plus was easy to use to handle processes running simultaneously (concurrency) in the multicore processor. In 2009, Go was finally released to the public as anopen-sourcelanguage. So, Go was born not for the sake of creating cool syntax, but purely for problem-solving industrial scale problems.

Design Philosophy: "Simplicity, Fast Compile, Concurrency-First"

If you're reading Go code for the first time, your first reaction might be, "Why is it like this?" or "How come it looks a bit old fashioned?" That's the goal. Go's design was built on three main pillars that are strongly maintained to this day:

1. Simplicity (Boring Simplicity)
Go was designed to be a "boring" language, and believe me, in the world of software engineering, boring is incredibly beautiful. Go purposely ditched many of the complex features that exist in other languages such as OOP's complicated inheritance (although it was added later with great care), or syntactic sugar.

The goal? So that if you, I, or a new engineer joins the team and reads Go's codebase, we all immediately understand what the code does without having to guess at the magic of framework behind the scenes. Go has a philosophy that code should be read more often than written.Plus, Go has a powerful built-in formatting rule called gofmt. No more hours of debate in the team about using tab or space, or where the curly braces should be placed. There is only one default.

2. Fast Compile
This is a direct answer to the problems its creators are having at Google. Go is compiled directly to machine code (machine code). The buildprocess is incredibly fast. You can have thousands of lines of code, type go build, and in a matter of seconds (even milliseconds), boom, there is one binary filethat is ready to run.

No need install additional runtime on server, no need to carry around folder dependencies that size giggling. You just have to move one binary file to your Linux, Windows, or Mac server, and the code will run. For deployment using Docker, this makes the size of your image container very small and very light.

3. Concurrency-First (Champion of Collaborative Affairs)
Here are Go's deadliest weapons: Goroutines and Channels. Nowadays, computer CPUs have many cores. Unfortunately, making an application that can use all core efficiently (aka multithreading) in a language like Java or C++ is half-dead difficult and prone to bug (race condition, deadlock).

Go solves this with Goroutines.Just think of Goroutines as a very, very lightweight version of thread. If in Java one thread can eat up 1-2 MB of RAM, one Goroutine in Go only takes up around 2 KB! This means that you can run tens or even hundreds of thousands of Goroutines simultaneously on one server without making your server scream out of memory. For communication between data that is being processed simultaneously, Go uses a system called Channels. So, you don't need to worry about lock-unlock memory, just throw data through this pipe called Channel. Safe, fast and easy to understand.

Quick Comparison: Go vs Other Languages

As engineers, we know there is no such thing as silver bullet aka a perfect language for everything. So that you have a better idea, let's compete Go with other popular languages so you know exactly when to choose what.

Go vs Java
Java is a giant in the world of enterprise. The ecosystem is very mature, the libraryis there to do anything, from banking to rockets.

  • The advantages of Go over Java: Go wins hands down in terms of memory consumption and startup speed. Java applications require a JVM (Java Virtual Machine) to run, which means the initial memory used up is quite large and booting the application takes time. Go, because it is directly compiled to binary, it starts up instantly and saves RAM. This is the reason why Go is so popular in the era of microservices and serverless.
  • Disadvantages of Go from Java: The Go ecosystem is not yet as mature as Java when it comes to enterprise systems inherited from the past (legacy).In Java, if you need strange design patterns, there is definitely a solution. In Go, you are required to write more manually without the magic of abstraction.
Go vs Python
Python is the undisputed king when it comes to Data Science, Machine Learning, and scripting fast.

  • Go's advantages over Python: Raw performance and concurrency. Python is default slow and tied to a GIL (Global Interpreter Lock) which makes it difficult for it to execute purely parallel processes. If you create an API with high traffic, Python will probably start to waste time and eat up a lot of resource servers, while Go can handle millions of request while remaining relaxed.
  • Cons of Go over Python: Speed development (prototyping). Writing code in Python is really fast and fun. To create proof of concept, Python is much more convenient. And of course, if you want AI games or heavy data processing, the Go ecosystem can't compete with Pandas, NumPy, or Python's PyTorch.
Go vs Node.js (JavaScript/TypeScript)
If you are used to creating full-stack websites, Node.js will definitely be your best friend.

  • Advantages of Go over Node.js: The concurrency Node.js architecture relies on single-thread event loop.If you give Node.js a CPU-heavy task (CPU-bound task like processing images or encrypting large data), that one application can block or crash, making Another request queued up. Go with its Goroutines doesn't have this problem; it distributes the load to all core CPUs automatically. Plus, Go's static type system (static typing) is built-in and very solid, no need to bother with setup like in TypeScript.
  • Disadvantages of Go from Node.js: In Node.js, you can use the same language (JavaScript/TypeScript) for both frontend and backend, which makes data exchange (such as JSON format) feel very natural and seamless. In Go, because the language is very structured, dealing with dynamic or random JSON structures can be more complicated and requires being extra diligent in defining the struct or data type.
Go vs Rust
Well, this is its eternal rival in the modern language arena. Both focus on high performance systems and are often compared.

  • Advantages of Go over Rust: Learning curve (learning curve)! Learning to Go is like learning to ride an automatic scooter; In a matter of days or weeks you can step on the gas and write code for production. It has little syntax and is easy to master.
  • Go's disadvantages over Rust: Rust prioritizes god-level memory safety without a Garbage Collector (GC). Rust uses the concept of borrow checker which makes Rust code, if it has been successfully compiledcompile, almost impossible to leak memory (memory leak).Go still uses GC running in background to clean up memory, which in the case of ultra-low latency systems (such as trading or game engine AAA), GC in Go can cause millisecond pauses (pause) that may otherwise not be possible. tolerated.

Who Has Used Go?

You won't be betting alone if you choose to enter this ecosystem. Go has passed the days of "trial and error technology" and is now the backbone of the modern internet.

Have you ever used Docker? Or a containerKubernetes orchestration champion? Everything is written purely in Go. This is the reason why Go is often referred to as the "mother tongue" of the Cloud-Native world.

On the application and services industry side:

  • Uber wrote hundreds of microservices they use Go to handle geolocation and routing millions of users in real-time.
  • Twitch moved their internal systems to Go to handle the load of massive interactive chats with latency.
  • SoundCloud was one of Go's early adopters to leverage it for media distribution efficiency.
  • And of course Google, the place where Go was born, uses it widely in internal systems, YouTube, all the way to Google Cloud services.

The Most Appropriate Types of Applications to Build with Go

Well, to conclude our mentoring session, you must be thinking, "Okay, the features are cool, but what do I have to use Go to do?" Don't use a sledgehammer to hit thumbtacks.This is where Go really shines brightly:

1. Backend API & Web Services with High Traffic
If you want to build a REST API, GraphQL, or gRPC server that will be hit by thousands or millions of requests per second, Go is the number one choice. The Goroutine feature allows your application to handle multiple client connections (e.g. chat websocket or streaming data) without creating your cloud server explodes because it needs giant RAM.

2. Microservices Architecture
Modern software trends often break down one giant application into smaller pieces (microservices). Because Go compiles code into a single smallbinary file, very fast boot time, and very minimal memory usage, Go is the golden child to include in container Docker and on-deploy on top of an orchestration system like Kubernetes.

3. CLI Tools (Command Line Interfaces)
Ever wondered why today's infra tools are so easy toinstall in the terminal without having to worry about dependencies? Because it was built using Go! Go has a built-in capability called cross-compilation. This means that from your Mac or Linux laptop, you can type one command and immediately produce a .exe file for Windows users, without needing to have a Windows machine. This makes Go a favorite for creating terminal automation tools.

4. Infrastructure & Cloud Networking Tools
As Kubernetes, Terraform, and Prometheus have proven, if you need to build an agent that sits on a server to pull data, manage a network, monitor system performance metrics, or automate server, Go is the de facto language for the DevOps and Site Reliability Engineering (SRE).

How about it, you're starting to get an idea now, right? Go is not a language created to show-off how good you are at writing complex one-line code. Go is a language for hard workers. This language is designed for us, engineers who want a stable system, server which is cheap but fast, deployis easy, and most importantly: I want to be able to sleep soundly on a Saturday night without being afraid of backend servers suddenly down because they run out memory.

My advice, slowly try making a simple REST API using Go in your next side project. Experience for yourself how cool it is to write code with a clear standard, without too much framework, and feel the sensation of lightning-fast compilation. Happy coding!
Sigit Wasis Subekti

Sigit Wasis Subekti

Software Engineer & Tech Educator

Software Engineer and Tech Educator sharing insights on web development and software architecture.