Beginner · Getting started with Go · topic 1 of 46 · 25 min
What Go is and why people use it
Explanation
Where Go came from
Go was designed at Google by Robert Griesemer, Rob Pike and Ken Thompson and announced as open source in November 2009. Version 1.0 came out in 2012 with a promise that still holds: code written for Go 1 keeps compiling with newer Go 1.x versions. A new Go version comes out about every six months, in February and August.
Google had huge programs written in C++ and Java. Building them took a long time, and new engineers struggled to read code full of clever tricks. Go was designed to fix exactly that: fast builds, simple rules, and good support for doing many things at the same time on servers.
Some words you will hear
- Compiled: a tool called the compiler turns your source code into a machine-code program before it runs. Python, by contrast, is read and run line by line by an interpreter.
- Static binary: one single program file that contains everything it needs. You copy that one file to a server and run it. No "install these 40 packages first".
- Statically typed: every variable has a type (number, text, true/false) that is checked before the program runs, so many mistakes are caught early.
- Garbage collected: Go frees memory you no longer use, automatically. You do not call free() like in C.
- Concurrency: doing many tasks at overlapping times, for example serving 10,000 users at once. Go has goroutines and channels for this, built into the language.
Why companies pick Go
| Reason | What it means in practice |
|---|---|
| Fast builds | Even large projects compile in seconds, so developers stay in flow. |
| Fast programs | Much faster than Python or Node.js for most server work, close enough to Java, with low memory use. |
| One binary | Deploying is copying one file or putting it in a tiny Docker image. |
| Built-in concurrency | Goroutines are cheap; one server can run hundreds of thousands of them. |
| Simple language | Few keywords and one standard format (gofmt), so code from any team looks familiar. |
| Strong standard library | HTTP servers, JSON, testing, crypto and more come with Go, no extra install. |
Where Go is used
Go is the main language of cloud infrastructure. Docker (the container engine), Kubernetes (which runs containers across many servers), Terraform (infrastructure as code), Prometheus (monitoring), etcd (a key-value store inside Kubernetes), Hugo (a website generator) and Caddy (a web server) are all written in Go. Companies such as Google, Uber, Cloudflare and Monzo use it for backend services, and in India many fintech and startup teams use it for high-traffic APIs. Zerodha, for example, has published open-source Go projects such as listmonk.
Where Go is not the best choice
- Data science and machine learning: Python has far more libraries (pandas, PyTorch).
- Mobile apps and browser front ends: Kotlin, Swift, Dart and JavaScript/TypeScript are the normal choices.
- Hard real-time or very low-level systems (game engines, device drivers): C, C++ or Rust give more control over memory.
Need help?
Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.
Try:
Watch the lesson
What Go is and why people use it · 1/7
Welcome to Go. In this lesson you will learn what Go is, where it came from and why so much cloud software is written in it.
Prefer a video by a teacher? Find free videos on “what is golang and why use it explained for beginners” on YouTube ↗
In real life: Why a payments team picked Go
Imagine a UPI payment-status service: every second, thousands of apps ask "did payment 4821 succeed?". Each request waits a little for the bank. In Go, each request runs in its own goroutine, which costs only a few kilobytes of memory, so one small server handles thousands of waiting requests. The team ships the service as a single binary inside a small Docker image, and it starts in milliseconds when traffic jumps on salary day.
package main
import "fmt"
func main() {
fmt.Println("Payment 4821: SUCCESS")
}Practice (0/3 done)
You build a Go web server with go build. What do you need to copy to the Linux server to run it (if it was built for Linux)?
Which of these tools is NOT written in Go?
In 5 to 8 lines, explain to a friend why a cloud company might choose Go over Python for a high-traffic API, and one case where Python is the better choice.
Quick quiz
Read more (free)
Related help
Related topics
- Installing Go and the go commandGetting started with Go · same module
- Your first program and Go modulesGetting started with Go · same module
- Variables, basic types and zero valuesGetting started with Go · same module
- Go in cloud and DevOps: Kubernetes, Terraform and PrometheusCLI tools and Go in cloud and DevOps
- What Rust is and why learn itRust Programming · Getting started with Rust
- Docker images for Go servicesCLI tools and Go in cloud and DevOps
Questions people ask about this
Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.
What does "compiled" mean for Go?
Answer: Code is turned into a machine-code program before it runs
The Go compiler turns source code into a binary before you run it.
What does a garbage collector do?
Answer: Frees memory your program no longer uses
The garbage collector finds memory nothing uses any more and frees it automatically.
How often does a new Go version usually come out?
Answer: About every six months (February and August)
Go has a regular release cycle: one major release in February and one in August.
Which feature does Go NOT have?
Answer: Class inheritance
Go has no classes and no inheritance. It uses structs, interfaces and embedding instead.
Why do DevOps teams like Go programs?
Answer: They ship as one binary that is easy to copy and containerise
A single static binary is easy to deploy, version and put in a small container image.
How does Prometheus get metrics from a Go service?Related
Answer: Prometheus scrapes an HTTP endpoint such as /metrics
Prometheus pulls metrics over HTTP on a schedule.
From Go in cloud and DevOps: Kubernetes, Terraform and Prometheus
For which job is Rust usually NOT the first choice?Related
Answer: A ten-line script to rename some files once
For a quick one-time script, Python or a shell is faster to write. Rust shines when speed and reliability matter.
Why copy go.mod and go.sum before the rest of the source?Related
Answer: So the go mod download layer is cached and reused when only code changes
Layer caching skips re-downloading dependencies.
What does the garbage collector do?Related
Answer: Frees memory that the program no longer uses
The GC automatically reclaims memory from objects nothing refers to any more.
From What C# and .NET are
Pass the quiz (60% or more) or mark this topic as done when you are ready.
Your progress is saved on this device only.
Next steps
- 4 more topics in “Getting started with Go” before its exam: Installing Go and the go command, Your first program and Go modules, Variables, basic types and zero values, Constants, iota and type conversions.
- Module 1 exam: Getting started with Go · 14 questions · 20 min, without help. 5 topics of this module still to finish first.
- Then the next module, Control flow and functions. 46 topics left in the course before the final exam.