golang/go
Components
This section is the entry point for understanding the major subsystems that make up the Go distribution. Each subsystem corresponds to one or more directories under src/.
The toolchain
These tools are what produces a Go program from source. They all live under src/cmd/.
| Component | Directory | Page |
|---|---|---|
| Compiler (gc) | src/cmd/compile/ |
Compiler |
go command |
src/cmd/go/ |
Go command |
| Linker | src/cmd/link/ |
Linker |
| Assembler | src/cmd/asm/ |
Assembler |
cgo |
src/cmd/cgo/ |
cgo |
Other tools you'll see in src/cmd/ but don't have dedicated pages here:
cmd/dist— the build coordinator (used bymake.bash); see Architecture.cmd/gofmt— the formatter; behavior is ingo/formatandgo/printer.cmd/vet— the static analyzer; usesgolang.org/x/tools/go/analysis(vendored).cmd/cover,cmd/covdata,cmd/preprofile— coverage and profiling helpers.cmd/pprof,cmd/trace,cmd/objdump,cmd/nm,cmd/addr2line,cmd/buildid,cmd/pack,cmd/test2json,cmd/distpack,cmd/relnote— assorted developer tools.
The runtime
The runtime is what every compiled Go binary embeds. It manages goroutines, memory, and OS interaction.
| Component | Directory | Page |
|---|---|---|
| Runtime (scheduler, GC, allocator, etc.) | src/runtime/ |
Runtime |
The standard library
Hundreds of packages under src/. Documented as a single overview page:
| Component | Directory | Page |
|---|---|---|
| Standard library | src/<pkg>/... |
Standard library |
How they fit together
graph TD
User[User .go source] --> GoCmd[cmd/go]
GoCmd -->|drives| Compile[cmd/compile]
GoCmd -->|drives| Asm[cmd/asm]
GoCmd -->|drives| Cgo[cmd/cgo]
GoCmd -->|drives| Link[cmd/link]
Compile --> Object[.a object archive]
Asm --> Object
Cgo --> Compile
Object --> Link
Link --> Binary[Executable]
Binary -.embeds.-> Runtime[runtime]
Binary -.uses.-> StdLib[Standard library]
StdLib -.runtime calls.-> RuntimeEach page below dives into one of these boxes. Start with the compiler if you want to understand "how is my Go code turned into machine code?" Start with the runtime if you want to understand "what happens when my Go program runs?"
Cross-cutting
- Go command is the orchestrator. It is the public face of the toolchain and where most user-visible behavior lives.
- cgo is technically a preprocessor + a runtime collaboration. It bridges Go and C.
- Standard library covers the library packages and their organization.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.