{"canonical_url":"https://engineer.company/glossary/go/","content_markdown":"# Go\n\n## What it is\n\nGo is a general-purpose programming language that began at Google, designed with systems programming\nin mind and with concurrency written into the language itself rather than added as a library. It is\noften called golang, after the project's first web address, golang.org; the project's FAQ is firm\nthat the language is just Go, written Go and never GO.\n\nGo's goals were first sketched on a whiteboard by Robert Griesemer, Rob Pike and Ken Thompson on\nSeptember 21, 2007, and on November 10, 2009, the language was released to the public as an\nopen-source project. Go 1 followed on March 28, 2012, with a promise that programs written for it\nwould keep compiling and running, unchanged, under every later Go 1 release. That promise still\nholds: the specification now describes language version go1.27, and Go 1.27.0 was released on August\n19, 2026. Generics arrived in Go 1.18, and the language's designers called them the biggest change\nsince the first open-source release.\n\nThe FAQ says the language grew out of a choice its authors were tired of making, between efficient\ncompilation, efficient execution and ease of programming. Go sets out to give all three. A program\nis built from packages, and the toolchain is one command, `go`, which builds, tests, formats and\nfetches dependencies. The keyword `go` in front of a function call starts a goroutine, a function\nrunning alongside the rest of the program, and goroutines are cheap enough that, the FAQ says,\nhundreds of thousands can share one address space. Channels carry values between them, and\n[Effective Go](https://go.dev/doc/effective_go) sums up the intended style in a slogan: “Do not\ncommunicate by sharing memory; instead, share memory by communicating.”\n\nTwo habits mark Go code wherever it is found. The `gofmt` program prints every source file in one\nstandard layout, so formatting is never argued about in review. And the compiler refuses a program\nwith an unused variable or an unused import, because the first may hide a bug and the second slows\nevery later build.\n\n## Why it matters\n\nThe decision Go answers is usually what to write a network service, a command-line tool or a piece\nof infrastructure in, and the alternatives sit on either side of it: a scripting language on one, C,\nC++ or Rust on the other.\n\nAgainst a scripting language, Go offers simple deployment and early errors. The linker produces\nstatically linked binaries by default, so the output of a build is one file that carries its own\nruntime and runs on a server with nothing else installed. The FAQ puts the price at a couple of\nmegabytes for a program that prints “hello, world”, against about 750 kB for the same program in C.\nType errors surface when the program is compiled rather than when a rarely used branch runs in\nproduction, and one founding goal was that even a large executable should build in a few seconds on\na single computer.\n\nAgainst C, C++ or Rust, Go offers simplicity and memory safety at the cost of control. A garbage\ncollector reclaims memory, so ordinary code is spared a whole class of use-after-free mistakes, but\nthe program does not decide exactly when memory is released, and every binary ships the runtime that\ndoes it. For most servers that is the right trade. For a kernel, a small embedded device or a hot\nloop that cannot tolerate a collector, it is the wrong one.\n\nThe quieter argument is time. In 2023 Russ Cox wrote that a Go 2 that breaks old programs “is never\ngoing to happen”, and that the project would “double down on compatibility” instead. The promise is\npaid for in upgrades rather than rewrites. A new major release ships every six months, in February\nand August, and each is supported until two newer ones exist, so a team that wants security fixes\nmoves forward about once a year.\n\nThe small language also writes some things out longhand. Errors are ordinary values, returned and\nchecked where they occur, which is explicit and repetitive in about equal measure.\n\n## What it looks like in practice\n\nA goroutine is cheap to start and just as cheap to lose. The page on\n[moving slow work onto a River job queue](/portfolio/moved-slow-work-onto-a-river-job-queue/)\nsays so plainly: do slow work in a goroutine and it disappears the moment the process restarts,\nmid-deploy, with no record that it was ever supposed to happen. The company moved that work onto\nRiver, which keeps its queue in PostgreSQL, so a job and the rows it touches commit or roll back\ntogether. Behind it sit 15 worker modules and 8 scheduled tasks, with 20 pg_cron jobs underneath. A\ngoroutine gives concurrency; durability has to come from somewhere else.\n\nTesting ships with the toolchain, and the\n[layered test suite](/portfolio/built-a-test-suite-across-go-sql-and-browser/) shows\nwhat that adds up to. Its Go API carries 981 test functions across 310 files, one of four layers\nthat are each tested where their behaviour lives, beside the frontend's specs and the database's own\nSQL tests.\n\nThe [continuous security programme](/portfolio/ran-a-continuous-security-scanning-programme/)\nleans on the language's tooling too. Go dependencies are checked with govulncheck, and a\nvulnerability recognised by the configured checks can fail the build. The page names the\nvolume of findings as the real cost of scanning, and govulncheck is designed against that cost: it\nreports a vulnerability only when the code's own functions call the affected function, directly or\nthrough others.\n\n## Where it goes wrong\n\n**A function reports an error when nothing went wrong.** An interface value in Go holds a type and a\nvalue, and it equals nil only when both are unset. A function that returns a nil pointer of a\nconcrete error type through the `error` interface hands its caller an interface that holds a type,\nand that interface is not nil:\n\n```go\nfunc save() error {\n    var err *ValidationError // a nil pointer\n    if invalid() {\n        err = \u0026ValidationError{}\n    }\n    return err // never equal to nil: the interface holds a type\n}\n```\n\nReturn a literal `nil` on success, and declare every error result as `error` rather than as a\nconcrete type.\n\n**A service that passed every test crashes under real traffic.** Map operations are deliberately\nleft unsynchronised, because locking every access would slow most programs, and the FAQ warns that\n“uncontrolled map access can crash the program”. The cause is one goroutine writing to a map while\nanother reads or writes it; reads alone are safe. Guard the map with a mutex, give it to a single\ngoroutine that the others reach through a channel, or use `sync.Map` for the cases it was designed\nfor. Then run the tests with `go test -race`. For a typical program the race detector can raise\nmemory use five to ten times and run time two to twenty times, and it finds only races on code paths\nthat actually run, so a binary built with `-race` and put under a realistic load finds more.\n\n**Goroutines started in a loop all work on the last item.** Before Go 1.22 a `for` loop had one\nvariable shared by every iteration, so a closure that captured it saw whatever value it held when\nthe goroutine finally ran. Go 1.22 gives each iteration its own variable, but only in modules whose\ngo.mod declares `go 1.22` or later, and older code keeps its old meaning even when a newer toolchain\nbuilds it. Raise the `go` line and run `go vet` and the tests. A test that starts failing after the\nchange was often checking the wrong value all along.\n\n**A build on a fresh machine stops to download a different Go.** Since Go 1.21 the `go` line is a\nrequirement, and when the installed toolchain is older than a module asks for, the `go` command\nfetches the newer one as a module and runs it from the module cache. On a laptop that is convenient;\nin an air-gapped build or a pinned container image it is a surprise. Install the toolchain the\ngo.mod names, and set the `GOTOOLCHAIN` environment variable when a build has to use one exact\nversion.\n\n## Further reading\n\n- [The Go Programming Language Specification](https://go.dev/ref/spec) — the reference manual for\n  every construct in the language, versioned with each release.\n- [Frequently Asked Questions (FAQ)](https://go.dev/doc/faq) — why the language was made, the design\n  decisions behind it, and the nil-error and map puzzles above.\n- [Go 1 and the Future of Go Programs](https://go.dev/doc/go1compat) — the compatibility promise and\n  the exceptions it allows.\n- [Release History](https://go.dev/doc/devel/release) — every release since Go 1, with the support\n  policy at the top.\n- [Data Race Detector](https://go.dev/doc/articles/race_detector) — how to run it, what it catches\n  and what it costs.\n- [Fixing For Loops in Go 1.22](https://go.dev/blog/loopvar-preview) — the loop-variable change, why\n  it is tied to go.mod, and how to test old code against it.\n\n\u003chttps://engineer.company/glossary/go/\u003e\n","date_modified":"2026-11-12T05:34:23Z","description":"What the Go language is, when its compatibility promise and single-file binaries pay off, and the concurrency and version traps that catch new teams.","formats":{"gemtext":"https://engineer.company/glossary/go/index.gmi","gopher":"https://engineer.company/glossary/go/gophermap","html":"https://engineer.company/glossary/go/","json":"https://engineer.company/glossary/go/index.json","markdown":"https://engineer.company/glossary/go/index.md","pdf":"https://engineer.company/glossary/go/index.pdf"},"kind":"page","language":"en","title":"What is Go?","url":"https://engineer.company/glossary/go/","version":1}