This glossary defines key terms and Go-specific terminology used throughout this book.
Algorithm: A step-by-step procedure for solving a problem.
API (Application Programming Interface): A set of functions and procedures that allow applications to interact with each other.
Compiler: A program that translates source code into machine code.
Concurrency: The ability of a program to manage multiple tasks simultaneously.
Deadlock: A situation where two or more processes are waiting for each other, causing all to be blocked.
Garbage Collection: Automatic memory management that frees memory no longer in use.
Interface: A contract that defines a set of methods that a type must implement.
Parallelism: The simultaneous execution of multiple tasks on multiple processors.
Race Condition: A situation where the outcome depends on the timing of concurrent operations.
Reflection: The ability of a program to examine and modify its own structure at runtime.
Stack: A region of memory for local variables and function calls.
Heap: A region of memory for dynamically allocated data.
Array: A fixed-size sequence of elements of the same type. In Go, arrays are value types.
Channel: A typed conduit for sending and receiving values between goroutines. Channels enable communication and synchronization.
Closure: A function that captures variables from its surrounding scope.
Defer: A statement that schedules a function call to execute when the surrounding function returns.
Embedding: Including one struct type in another, allowing the outer type to access the inner type's methods and fields.
Goroutine: A lightweight thread managed by the Go runtime. Goroutines enable concurrent execution.
Interface Satisfaction: In Go, a type satisfies an interface implicitly by implementing all required methods. No explicit declaration is needed.
Iota: A predeclared identifier that represents successive integer constants in constant declarations.
Map: An unordered collection of key-value pairs. Maps are reference types.
Method: A function with a special receiver argument that operates on a type.
Module: A collection of Go packages stored in a file tree with a go.mod file at its root.
Package: A collection of Go source files in the same directory that are compiled together.
Pointer: A variable that stores the memory address of another variable.
Receiver: A parameter in a method declaration that specifies the type the method operates on.
Rune: An alias for int32 representing a Unicode code point.
Slice: A dynamically-sized, flexible view into an underlying array. Slices are reference types.
Struct: A composite type that groups together zero or more named fields of possibly different types.
Type Assertion: An operation that extracts the concrete value from an interface value.
Type Switch: A switch statement that compares types rather than values.
Variadic Function: A function that accepts a variable number of arguments of the same type.
Zero Value: The value a variable is given when declared without an explicit initialization.
Buffered Channel: A channel with a capacity that can hold multiple values before blocking.
Context: A package that provides cancellation, timeouts, and request-scoped values.
Fan-in: A pattern where multiple input channels are combined into a single output channel.
Fan-out: A pattern where work is distributed from one channel to multiple workers.
Mutex: A mutual exclusion lock that ensures only one goroutine accesses shared data at a time.
Pipeline: A series of stages connected by channels, where each stage transforms data.
Select: A statement that waits on multiple channel operations, executing the first one that's ready.
Unbuffered Channel: A channel with no capacity that blocks until both sender and receiver are ready.
WaitGroup: A synchronization primitive that waits for a collection of goroutines to finish.
Worker Pool: A pattern that limits the number of concurrent goroutines processing work.
Build Tag: A comment that controls which files are included in a build based on constraints.
CGO: A tool that enables Go programs to call C code and vice versa.
Escape Analysis: Compiler analysis that determines whether values can be allocated on the stack or must be on the heap.
Generics: A feature (Go 1.18+) that allows writing code that works with multiple types while maintaining type safety.
Reflection: The ability to examine and manipulate program structure at runtime, provided by the reflect package.
Type Parameter: A placeholder for a type in generic code, specified when using the generic function or type.
Workspace: A collection of Go modules defined by a go.work file, allowing local development across multiple modules.
fmt: Package for formatted I/O, including printing and scanning.
net/http: Package for HTTP client and server implementation.
sync: Package providing synchronization primitives like mutexes and wait groups.
context: Package for cancellation, timeouts, and request-scoped values.
testing: Package providing testing support, including tests, benchmarks, and examples.
encoding/json: Package for JSON encoding and decoding.
time: Package for time and date operations.
os: Package providing operating system interface, including file operations and environment variables.
go.mod: The file that defines a Go module, including its path and dependencies.
go.sum: The file that contains checksums for module dependencies, ensuring integrity.
GOPATH: The workspace directory for Go code (legacy, replaced by modules).
GOROOT: The directory where Go is installed.
gofmt: The tool that formats Go source code according to standard style.
go vet: A tool that reports suspicious code constructs.
godoc: A tool that extracts and displays documentation from Go source code.
pprof: A tool for performance profiling and analysis.
Understanding these terms is essential for effective communication about Go code and concepts. This glossary provides a foundation for understanding Go-specific terminology used throughout this book.