When you install Go, you install:

In summary: You install the language and the entire toolchain required to write, compile, and run Go programs.


⚙️ How the Go Compilation Process Works

Let’s suppose you have a main.go file. Here’s what happens when you run go run main.go or go build:

  1. Parsing (Lexical and Syntactic Analysis)

    The compiler reads the code and transforms it into an abstract syntax tree (AST).

  2. Type Checking

    It verifies that the types are correct: whether variables are used properly, whether functions return what they promise, etc.

  3. Compilation to Intermediate Code (SSA)

    Go converts the AST into a format called SSA (Static Single Assignment), an intermediate representation that facilitates optimizations.

  4. Machine Code Generation

    The compiler then translates this into native machine code for your platform (e.g., x86_64, ARM, etc.).

  5. Linking

    The linker joins all the necessary object files (.o) — including those from the standard library — and creates a single static binary (by default).


💡 go run vs go build vs go install