Skip to content

Beginner · Getting started with Go · topic 1 of 46 · 25 min

What Go is and why people use it

Explanation

Go (also called Golang) is a programming language made at Google and released as open source in 2009. It is compiled into one fast program file, it cleans up memory for you, and it has very few features on purpose, so code stays easy to read. Docker, Kubernetes, Terraform and Prometheus are written in Go.

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.
Think of it like this: Think of Go as a well-made Indian pressure cooker. It does not have fifty buttons like a fancy multi-cooker, but it is fast, reliable, everyone in the family knows how to use it, and it rarely surprises you. Go trades fancy features for speed and clarity.

Why companies pick Go

ReasonWhat it means in practice
Fast buildsEven large projects compile in seconds, so developers stay in flow.
Fast programsMuch faster than Python or Node.js for most server work, close enough to Java, with low memory use.
One binaryDeploying is copying one file or putting it in a tiny Docker image.
Built-in concurrencyGoroutines are cheap; one server can run hundreds of thousands of them.
Simple languageFew keywords and one standard format (gofmt), so code from any team looks familiar.
Strong standard libraryHTTP 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.
Careful: Common mistake: expecting Go to feel like Java or Python. Go has no classes, no inheritance and no exceptions. It has structs, interfaces and errors as normal values. If you try to write Java in Go, the code fights you. Learn the Go way; it is simpler once it clicks.
Tip: You will see both "Go" and "Golang". The language is called Go. "Golang" comes from the old website golang.org and is handy when searching online.

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

What is Go?

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.

go
package main

import "fmt"

func main() {
	fmt.Println("Payment 4821: SUCCESS")
}
Every Go program starts in func main of package main. You will write this yourself in the next topics.

Practice (0/3 done)

Task 1 · Question

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)?

Task 2 · Question

Which of these tools is NOT written in Go?

Task 3 · Practice

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

Question 1

1.What does "compiled" mean for Go?

Question 2

2.What does a garbage collector do?

Question 3

3.How often does a new Go version usually come out?

Question 4

4.Which feature does Go NOT have?

Question 5

5.Why do DevOps teams like Go programs?

Read more (free)

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.

From What Rust is and why learn it

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.

From Docker images for Go services

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

  1. 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.
  2. Module 1 exam: Getting started with Go · 14 questions · 20 min, without help. 5 topics of this module still to finish first.
  3. Then the next module, Control flow and functions. 46 topics left in the course before the final exam.