Go: Overview of the Compiler

A Journey With Go
Published in
5 min readSep 7, 2019


Illustration created for “A Journey With Go”, made from the original Go Gopher, created by Renee French.

ℹ️ This article is based on Go 1.13.

The Go compiler is an important tool in the Go ecosystem since it is one of the essential steps for building our programs to executable binaries. The journey of the compiler is a long one, it has been written in C to move to Go and many optimizations and cleanups will keep happening in the future. Let’s discover the high level of its operations.


The Go compiler is composed of four phases that could be grouped into two categories:

  • frontend. This phase runs an analysis from the source code and produces an abstract syntactic structure of source code, called AST.
  • backend. The second phase will transform the representation of the source code into machine code, along with several optimizations.
compiler documentation

In order to better understand each phase, let’s use a simple program: