golang/go
Glossary
Terms that appear repeatedly in this codebase and would not necessarily be obvious to a Go user who is reading the source for the first time. Most of these come from src/runtime/HACKING.md, src/cmd/compile/README.md, and src/cmd/compile/internal/ssa/README.md.
Compiler / language
- gc — the Go compiler in
src/cmd/compile/. Stands for "Go compiler," not "garbage collector." This is the reference implementation. - gccgo — a separate Go front-end for GCC, lives outside this repo. Not maintained here.
- AST — abstract syntax tree. The parser in
cmd/compile/internal/syntaxproduces a syntax-AST; the noder converts it into the compiler's IR (cmd/compile/internal/ir). - IR — the compiler's middle-end intermediate representation. Distinct from the syntax AST and from SSA.
- SSA — static single assignment form. The lower-level IR used in
cmd/compile/internal/ssafor optimizations and code generation. - Walk / order — the pass in
cmd/compile/internal/walkthat decomposes complex statements and desugars high-level constructs (range, switch, map ops, etc.). - Noder — the pass that translates type-checked syntax into compiler IR. Lives in
cmd/compile/internal/noder. - Unified IR — the serialized IR format used both for export data and for noding inside a package; see
cmd/compile/internal/noder/README.md. - Export data — the serialized package summary
compilewrites alongside the object archive so that downstream packages can import this one. - Escape analysis — the pass that decides whether a value can stay on the stack or must be heap-allocated.
-gcflags=-mreports its decisions. - Inlining — function inlining decisions, in
cmd/compile/internal/inline. Influenced by PGO. - PGO — profile-guided optimization. The compiler can consume a
default.pgoto bias inlining and devirtualization. - Devirtualization — replacing an interface method call with a direct call when the dynamic type can be statically inferred.
- Intrinsic — a special function that the compiler replaces with hand-tuned SSA or assembly during compilation (e.g.,
math/bits.LeadingZeros64). - GOEXPERIMENT — set of opt-in experimental features compiled into the toolchain. Defined in
src/internal/goexperiment/.
Runtime
- G — a goroutine. The struct is
runtime.g. - M — an OS thread (a "machine"). The struct is
runtime.m. - P — a "processor," i.e., a scheduling context. There are exactly
GOMAXPROCSPs. The struct isruntime.p. - g0 — the system stack G owned by each M. Used to run runtime code that must not be on a user goroutine's growable stack.
- gsignal — the signal-handling G. Owns the signal stack on Unix.
- mcache — per-P cache of small-object spans, in
runtime/mcache.go. - mcentral — global pool of partially-allocated spans of one size class, in
runtime/mcentral.go. - mheap — the global heap, in
runtime/mheap.go. Manages the address-space arenas and large objects. - Span (mspan) — a run of contiguous pages dedicated to one size class, in
runtime/mheap.go. - Size class — one of about 67 fixed object sizes used by the small-object allocator. Defined in
runtime/sizeclasses.go. - Tiny allocator — a sub-allocator within mcache for objects ≤ 16 bytes, in
runtime/malloc.go. - Write barrier — a small piece of code emitted by the compiler around pointer writes so the GC can track reachability. The runtime side lives in
runtime/mwbbuf.goandruntime/mbarrier.go. - Hybrid write barrier — Go's specific GC barrier scheme combining Yuasa and Dijkstra barriers. Background in
runtime/mbarrier.go. - Mark and sweep — Go's GC algorithm. Concurrent, non-moving, tri-color, in
runtime/mgc*.go. - GC pacing — the algorithm that decides when to start the next GC cycle. Lives in
runtime/mgcpacer.go. - GOGC — environment variable controlling GC trigger ratio. Default 100.
- GOMEMLIMIT — soft memory cap honored by the GC pacer.
- GMP scheduler — the goroutine-machine-processor scheduler in
runtime/proc.go. - Work stealing — the scheduler's mechanism: an idle P steals goroutines from another P's local run queue.
- sysmon — a single special M that runs without a P, monitoring for preemption, network polling, and other periodic tasks. See
runtime.sysmoninproc.go. - Preemption — Go uses asynchronous (signal-based) and cooperative preemption to interrupt long-running goroutines. See
runtime/preempt.go. - stackGrow / morestack — the runtime entry that splits a goroutine's stack when it overflows.
- nosplit —
//go:nosplitannotation; tells the compiler not to insert a stack-grow check prologue. Used in low-level runtime code. - linkname —
//go:linknamedirective; allows a function declaration in one package to be backed by an unexported function in another. Used heavily for thesync,reflect,os, andtime↔runtimeboundary. - VDSO — virtual dynamic shared object. Linux mechanism for fast syscalls (
gettimeofday,clock_gettime); seeruntime/vdso_linux*.go. - netpoll — the runtime's network poller, integrating epoll/kqueue/IOCP with the goroutine scheduler. Lives in
runtime/netpoll*.go. - Goroutine leak profile — instrumentation in
runtime/goroutineleakprofile_test.goand supporting code that surfaces stuck goroutines. - Trace v2 — the execution tracer used by
runtime/trace,cmd/trace, andgo tool trace. Backend lives inruntime/trace.goand friends.
Linker / object files
- obj.Prog — a single pseudo-assembly instruction the compiler emits and the linker/assembler consume. Defined in
src/cmd/internal/obj/. - goobj — Go's internal object-file format, in
src/cmd/internal/goobj/. - Pcdata / Funcdata — auxiliary metadata streams attached to functions: PC-to-line tables, frame-pointer info, GC pointer maps. See
src/runtime/symtab.go. - Linkmode — the linker's
-linkmode=internal(Go's own linker) vs.-linkmode=external(delegate to the host linker; required for some cgo configurations). - Buildmode —
exe,pie,shared,c-archive,c-shared,plugin. Seecmd/go help buildmode.
Build / go command
- GOPATH — legacy workspace layout, mostly superseded by modules. Still used as a download cache.
- GOROOT — the directory containing the Go installation (this repo, in dev).
- GOMODCACHE — cache of downloaded module versions (
$GOPATH/pkg/modby default). - Module /
go.mod— Go's dependency unit since 1.11. Thecmd/go/internal/modloadpackage implements the loader. - MVS — minimum version selection, the algorithm Go modules use to pick versions. Implemented in
cmd/go/internal/mvs/. - Build cache — content-addressed cache of compiled objects keyed by tool inputs, in
cmd/go/internal/cache/. - Trybot / Builders — the CI cluster (lives in
golang.org/x/build) that runs all-platform tests on every CL. - Toolchain switching —
GOTOOLCHAINletsgore-exec a different Go release based ongo.mod'sgoandtoolchaindirectives. Seecmd/go/internal/toolchain/.
Standard library / language constructs
- Goroutine — a lightweight thread of execution managed by the runtime, started with
go f(). - Channel — typed conduit for goroutine communication. Implementation in
runtime/chan.go. - Defer — postponed function call, runs on function return. Implementation in
runtime/panic.go. - Panic / recover — the runtime's exception-like mechanism.
runtime/panic.gois the central source. - iota — the constant generator inside
const (...)blocks. Resolved by the compiler. - Build tag / build constraint —
//go:builddirectives; documented incmd/go/internal/imports/build.goandgo help buildconstraint. - Generic — type-parameterized declaration. Type checker in
cmd/compile/internal/types2; instantiation handled during noding.
Testing / instrumentation
testing.T,testing.B,testing.F— standard test, benchmark, and fuzz harness insrc/testing/.- Fuzzing — coverage-guided fuzzing introduced in Go 1.18. Engine lives in
src/internal/fuzz/. - race detector — ThreadSanitizer-based race detector activated by
-race. Stub Go-side files areruntime/race*.go; the C library is vendored undersrc/runtime/race/. - MSan / ASan — memory and address sanitizer integration; see
runtime/msan*.go,runtime/asan*.go. testdir—src/cmd/internal/testdir, the harness that runs the small Go programs intest/and checks// errorcheck/// runannotations.- GODEBUG — runtime debug knobs documented in
doc/godebug.md. Also used to keep old behavior alive across language changes.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.