Open-Source Wikis

/

Go

/

Go

/

Glossary

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/syntax produces 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/ssa for optimizations and code generation.
  • Walk / order — the pass in cmd/compile/internal/walk that 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 compile writes 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=-m reports its decisions.
  • Inlining — function inlining decisions, in cmd/compile/internal/inline. Influenced by PGO.
  • PGO — profile-guided optimization. The compiler can consume a default.pgo to 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 GOMAXPROCS Ps. The struct is runtime.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.go and runtime/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.sysmon in proc.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:nosplit annotation; tells the compiler not to insert a stack-grow check prologue. Used in low-level runtime code.
  • linkname//go:linkname directive; allows a function declaration in one package to be backed by an unexported function in another. Used heavily for the sync, reflect, os, and timeruntime boundary.
  • VDSO — virtual dynamic shared object. Linux mechanism for fast syscalls (gettimeofday, clock_gettime); see runtime/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.go and supporting code that surfaces stuck goroutines.
  • Trace v2 — the execution tracer used by runtime/trace, cmd/trace, and go tool trace. Backend lives in runtime/trace.go and 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).
  • Buildmodeexe, pie, shared, c-archive, c-shared, plugin. See cmd/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/mod by default).
  • Module / go.mod — Go's dependency unit since 1.11. The cmd/go/internal/modload package 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 switchingGOTOOLCHAIN lets go re-exec a different Go release based on go.mod's go and toolchain directives. See cmd/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.go is the central source.
  • iota — the constant generator inside const (...) blocks. Resolved by the compiler.
  • Build tag / build constraint//go:build directives; documented in cmd/go/internal/imports/build.go and go 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 in src/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 are runtime/race*.go; the C library is vendored under src/runtime/race/.
  • MSan / ASan — memory and address sanitizer integration; see runtime/msan*.go, runtime/asan*.go.
  • testdirsrc/cmd/internal/testdir, the harness that runs the small Go programs in test/ and checks // errorcheck/// run annotations.
  • 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.

Glossary – Go wiki | Factory