beginner 8 min read

Glossary of Go terms

Every term used across the Go module, defined in plain language and linked to the lesson where it’s explained in full. Skim it as a refresher, or use your browser’s find (Ctrl/Cmd-F) to jump to a word. Terms are grouped by theme.

Language basics

Go (Golang) — A statically typed, compiled, garbage-collected programming language built at Google for simple, fast systems software. See Why Go?

Compiled — Turned into native machine code ahead of time, rather than interpreted as it runs. Go programs compile to a single binary. See Why Go?

Statically typed — Every value’s type is known at compile time, so type errors are caught before the program runs. See Values, variables & types

Binary — The single self-contained executable file go build produces, runnable without Go installed. See Your first Go program

package main — The special package that produces a runnable command; it must contain a func main() entry point. See Your first Go program

Zero value — The default value a variable takes when declared without one: 0, false, "", or nil. See Values, variables & types

const — A declaration for a value that never changes. See Values, variables & types

The toolchain

go build / go run — Compile to a keepable binary, or compile-and-run once. See The Go toolchain

gofmt — The tool that rewrites code into Go’s one official style. See The Go toolchain

go vet — A tool that flags suspicious, likely-buggy code that still compiles. See The Go toolchain

go.mod — The file that defines a module and pins its dependency versions. See Packages & modules

Functions and types

Function — A named block of code that takes parameters and can return values; Go functions can return multiple values. See Functions & error handling

error — The built-in interface a fallible function returns; nil means success. See Functions & error handling

if err != nil — The standard idiom for handling a failed call. See Functions & error handling

defer — Schedules a call to run when the surrounding function returns, used for cleanup. See Functions & error handling

Struct — A type that groups named fields together. See Structs & methods

Method — A function attached to a type through a receiver. See Structs & methods

Receiver — The type a method belongs to; a pointer receiver (*T) can modify the value, a value receiver (T) works on a copy. See Structs & methods

Embedding — Placing one struct (or interface) inside another to reuse its fields and methods — Go’s composition in place of inheritance. See Structs & methods

Interface — A set of method signatures; a type satisfies it implicitly by having those methods. See Interfaces & composition

io.Reader — The one-method standard interface for “something you can read bytes from,” satisfied by files, sockets, buffers, and more. See The standard library

Concurrency

Concurrency — Structuring a program as independently running tasks (distinct from parallelism, running them literally at once). See Goroutines

Goroutine — A function launched with the go keyword that runs concurrently; lightweight and scheduled by Go’s runtime. See Goroutines

Channel — A typed pipe that passes values between goroutines; ch <- v sends, <-ch receives. See Channels

Buffered / unbuffered channel — Unbuffered channels make sender and receiver rendezvous; buffered channels hold a set number of values. See Channels

Data race — A bug where goroutines access the same variable at once with no synchronization; caught by go test -race. See Channels

select — A statement that waits on multiple channel operations and proceeds with whichever is ready first. See select & synchronization

sync.Mutex — A lock that guards shared state so only one goroutine enters a critical section at a time. See select & synchronization

sync.WaitGroup — A counter that lets one goroutine wait for a group of others to finish. See select & synchronization

context — A value that carries cancellation and deadlines across a call tree. See select & synchronization

Code organization

Package — A directory of Go files compiled together and imported as a unit. See Packages & modules

Module — A versioned collection of packages defined by go.mod. See Packages & modules

Exported / unexported — A capitalized name is exported (visible to other packages); a lowercase name is private to its package. See Packages & modules

internal/ — A directory whose packages can only be imported within the same module. See Packages & modules

Collections and generics

Slice — A growable, ordered view into an array, extended with append. See Slices, maps & generics

Map — A key/value lookup table; the value, ok form reports whether a key is present. See Slices, maps & generics

append / make / copy — Built-ins to grow a slice, allocate a slice/map, and copy slice contents. See Slices, maps & generics

Generics (type parameters) — Writing one function or type that works across many types safely, added in Go 1.18. See Slices, maps & generics

Testing

go test — The command that runs tests in _test.go files. See Testing in Go

Table-driven test — A test that lists its cases as data and loops over them, Go’s dominant testing style. See Testing in Go

Benchmark — A func BenchmarkX(b *testing.B) that measures performance with go test -bench. See Testing in Go

Standard library — The large set of packages Go ships with — io, net/http, encoding/json, and many more — reducing the need for dependencies. See The standard library

Control flow & memory

Control flow — Go’s small set of control structures: if, a single for loop that covers every looping case, and switch. See Control flow

Pointer — A value holding the address of another value; Go has pointers (*T, &x) but no pointer arithmetic. See Pointers

Data & text

Rune — Go’s name for a Unicode code point (an int32); ranging over a string yields runes, not bytes. See Strings, bytes & runes

Struct tag — A string annotation on a struct field (like json:"name") that guides encoding such as JSON. See JSON & serialization

Marshal / Unmarshal — Converting a Go value to JSON (marshal) and back (unmarshal) with encoding/json. See JSON & serialization

bufio — Buffered wrappers around readers and writers for efficient I/O. See Working with files & I/O

Concurrency

Context — A value carrying cancellation and deadlines through a call tree; passed as the first argument by convention. See Context & cancellation

Worker pool — A fixed set of goroutines pulling jobs off a channel — a core concurrency pattern. See Concurrency patterns

Pipeline / fan-out / fan-in — Composing stages connected by channels, splitting work across goroutines and merging results. See Concurrency patterns

Dependencies, errors & quality

go.sum — The file recording cryptographic checksums of dependencies for reproducible, verifiable builds. See Dependency management

Error wrapping — Adding context to an error with fmt.Errorf("...: %w", err), inspected later with errors.Is / errors.As. See Error-handling patterns

Sentinel error — A predefined error value (like io.EOF) compared against with errors.Is. See Error-handling patterns

Benchmark / pprof — A func BenchmarkX(b *testing.B) measuring performance, and the profiler for finding hot paths. See Benchmarking & profiling

delve — The Go debugger (dlv) for stepping through code and inspecting state. See Debugging Go

log/slog — The standard structured-logging package: leveled log records with key/value attributes. See Logging with slog

Idioms & structure

cmd/ and internal/ — Conventional directories for entry points and private packages in a Go repository. See Structuring a Go project

Idiomatic Go — Code written the community way: gofmt-formatted, explicit errors, small interfaces, clear names. See Writing idiomatic Go