Programming language · 2009

Go

Programming language developed by Google and the open-source community.

Official site ›
Go logo
C, Go, AssemblyWritten in
2009First released
GoogleDeveloper
staticTyping
BSD licensesLicense
Built fromInfluenced Go CGoAssemblyNewsqueakLimboAlefOberon-2Modula-2VCrystalOdin
CompilerRuntimeInfluence
ReplacedC, Python, and Java for many cloud and network services
Being replaced byStill growing; Rust competes for the most performance-sensitive parts

What is Go written in?

Go is self-hosting: since Go 1.5, the Go compiler and most of the runtime have been written in Go. Before that rewrite, the original Go compiler was written in C.

What Go is used for

Go is built for cloud infrastructure and networked services: its fast compilation, simple concurrency (goroutines), and single static binaries make it ideal for servers, CLIs, and DevOps tooling.

Notable software: Docker, Kubernetes, Terraform, and much of the modern cloud-native stack are written in Go.

About Go

Go is a programming language developed by Google and the open-source community. It is a statically typed and garbage-collected language that compiles ahead of time to native machine code. It supports imperative and concurrent programming.

Go first appeared in 2009 and was designed by Rob Pike, Ken Thompson, and Robert Griesemer at Google. Go has a large, active user base today.

Go in the language family tree

Go drew on ideas from Newsqueak, Limbo, Alef, Oberon-2, and Oberon and went on to influence V, Crystal, and Odin.

Sources: Wikipedia · Wikidata · Official site

Quick Facts

Short answer
Go compiler and runtime are written in Go
Self-hosting since
Go 1.5 in 2015
Before Go 1.5
Compiler written in C
Low-level pieces
Some assembly remains

Go before and after Go 1.5

The original Go toolchain was written in C. Robert Griesemer, Rob Pike, and Ken Thompson designed Go at Google beginning in 2007, and the first open-source release in November 2009 shipped with a C compiler. Using C was pragmatic: the team were C experts, the Go runtime and scheduler concepts were familiar in C, and writing a new language's first compiler in C is the conventional bootstrapping path.

The move to a self-hosted compiler was deliberate and methodical. In 2013, Russ Cox created a tool that mechanically translated the C compiler source to Go, producing a Go compiler that was syntactically Go but still structurally a C program. That automatically translated compiler was the foundation for Go 1.5's compiler, released in August 2015.

Go 1.5 removed the C compiler entirely from the toolchain. The build system no longer required a C toolchain: you only needed a prior Go binary to bootstrap. The same release also moved the runtime's garbage collector and scheduler from C to Go, significantly improving the ability of Go contributors to understand and modify the runtime. The Go garbage collector, written in Go since 1.5, received major improvements in 1.5 (concurrent), 1.8 (sub-millisecond pauses), and 1.14 (preemptible goroutines).

Go runtime architecture

The Go runtime is written in Go and a small amount of assembly, and provides three major services: goroutine scheduling, garbage collection, and low-level primitives for the standard library.

Goroutines are Go's concurrency primitive. They are multiplexed onto operating system threads using an M:N scheduler. The scheduler's model has three entities: M (OS thread), P (logical processor, controlled by GOMAXPROCS), and G (goroutine). Each P holds a local run queue of goroutines and draws from a global run queue when its own is empty. Work stealing lets an idle P take goroutines from a busy P's queue, keeping all available OS threads occupied.

Go's garbage collector is a concurrent tri-color mark-sweep collector designed for low-latency applications. The collector runs concurrently with the program during the mark and sweep phases and stops the world only briefly to acknowledge marking completion and to flip the write barrier state. Goroutine stacks start small (a few kilobytes) and grow by copying to a larger allocation on demand, which allows starting hundreds of thousands of goroutines in a single process without pre-allocating large stacks.

Go implementation layers

LayerWritten inNotes
gc compiler (go tool compile)GoSelf-hosted since Go 1.5 (August 2015)
Original compilerCUsed before Go 1.5; mechanically translated to Go in 2013 to 2015
Runtime (scheduler, GC)Go and assemblyConcurrent GC, goroutine scheduler using the GMP model
Standard libraryGoNearly all pure Go, with small assembly stubs for atomic operations and syscalls
gccgoC++Alternative Go frontend for GCC; less commonly used than the gc compiler

Go release history

Go was designed by Robert Griesemer, Rob Pike, and Ken Thompson at Google starting in September 2007. The initial goal was a language that addressed frustrations with C++ build times and Java's verbosity while retaining C-like simplicity. Go's concurrency model drew from Tony Hoare's Communicating Sequential Processes (CSP), which Rob Pike had previously explored in the Newsqueak and Limbo languages.

Go was open-sourced in November 2009 under a BSD-style license. Go 1.0 shipped in March 2012 with a compatibility guarantee: source code written for Go 1.0 would continue to compile on all future Go 1.x releases. That promise has been kept without exception.

Key releases: Go 1.5 (August 2015, self-hosted compiler and concurrent GC), Go 1.11 (2018, module system replacing GOPATH), Go 1.14 (2020, asynchronous preemption for goroutines), Go 1.18 (March 2022, generics via type parameters, the biggest language change since 1.0), Go 1.21 (August 2023, built-in min, max, and clear functions, WASI preview), Go 1.22 (2024, loop variable semantics corrected). Go ships two releases per year, in February and August.

Frequently Asked Questions

What language is Go written in?
Go is self-hosting. Since Go 1.5 in 2015, the Go compiler and most of the runtime have been written in Go. The earlier Go compiler was written in C.
What languages influenced Go?
Go was influenced by Newsqueak, Limbo, Alef among others. See the influence section above for the full list.
Which languages did Go influence?
Go influenced V, Crystal, Odin among others.
Is Go self-hosting?
Yes, Go is self-hosting, its compiler can compile itself.
When was Go first released?
Go was first released in 2009. It was designed by Rob Pike, Ken Thompson, and Robert Griesemer.

Evidence Sources

Discover More

Embed this graph

Paste this iframe into any HTML page to show the Go relationship graph.

<iframe src="https://www.languagelineage.org/embed?lang=go" width="100%" height="500" loading="lazy" style="border:0" title="Go relationship graph"></iframe>

Please attribute the visualization to Language Lineage and link to the Go source record.

Explore Go in Graph →