Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Introduction to Go  ›  Lesson

Why Go, and Where It Came From

Why use Go 10 minGo was designed at Google to keep large programs simple to read, quick to compile and easy to run concurrently, and it has stayed deliberately small and backwards compatible since version 1.0.

Why Go, and Where It Came From

Imagine you want to give colleagues a tool called tally that counts the words in any text file. Some use Windows, some use Macs, and none of them want to install a language runtime first. That wish, "one file that just runs, built from code anyone can read", is close to the reason Go exists. tally is also the program you will grow, piece by piece, through this whole course.

The rule

Go trades clever features for fast builds, plain code and easy concurrency.

Go was started in 2007 at Google by Robert Griesemer, Rob Pike and Ken Thompson. They were tired of huge programs that took ages to compile and were hard for new team members to read. It became open source in 2009, and Go 1.0 arrived in 2012 with a promise that still holds: code written for Go 1 keeps compiling on every later Go 1 release. New versions arrive about twice a year and add carefully, for example generics (2022) or looping over a plain number with range (2024).

Each part of the rule is a design choice:

  • Fast builds: the compiler is quick even on large projects, and it produces a single native binary with no virtual machine to install. It can also cross-compile: build a Windows tally.exe on a Mac.
  • Plain code: few keywords, one official formatting style (gofmt), and no feature that lets two teams write the same thing in wildly different ways. Code you did not write still looks familiar.
  • Easy concurrency: goroutines (very cheap threads) and channels are built into the language, which is why so many servers and cloud tools use Go. Docker, Kubernetes and Terraform are all written in it.

Garbage collection means you rarely think about freeing memory, while static types catch mistakes at compile time rather than in front of a user.

The shortcut

To decide whether Go fits a job, ask three questions: Does it run on servers or the command line? Will a team maintain it for years? Does it do many things at once? The more "yes" answers, the better Go fits.

Does Go fit tally?Step 1 of 4
  1. Where does it run?

    In a terminal on three operating systems. Go's single binary and cross-compiling fit perfectly.

The trap is thinking "simple" means "weak". Go leaves features out on purpose so that code stays easy to read; it is still used for some of the busiest systems on the internet.

Drills

Answer fast — trust the rule.

quick drill

What does go build normally give you for a command-line tool?

quick drill

What does the Go 1 compatibility promise mean?

quick drill

Which of these is a design goal of Go?

quick drill

Which job suits Go least?

Remember

  • Go trades clever features for fast builds, plain code and easy concurrency.
  • Shortcut: servers or CLIs, long-lived team code, lots happening at once — the more yeses, the better the fit.
  • Trap: small is a choice, not a weakness; and the Go 1 promise keeps old code compiling.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainPitch Go for tally

Your team wants to ship tally, a small command-line tool that counts words in text files, to colleagues on Windows, macOS and Linux. Explain two or three reasons Go is a good fit, and one situation where you would pick a different language.