Glossary
Go's vocabulary, defined in plain English. Every term links to the page that shows it working.
66 terms
- Alias
- A second name for an existing type, written type A = B. Both names refer to one identical type.Types
- Argument
- A value handed to a function at the call site. The function receives it as a parameter.Functions
- Assignability
- Whether a value of one type may be stored in a variable of another without conversion.Types
- Atomic operation
- A read or write that completes as a single indivisible step, so no other goroutine can observe it half-done.Atomic Operations
- Bit clear
- The &^ operator. Keeps the bits on its left except any the right has set.Bitwise Operators
- Bitmask
- A value AND-ed against another to keep only the bits you want.Bitwise Operators
- Blank identifier
- The underscore, used to receive a value and discard it.Variables
- Buffered channel
- A channel with room for a set number of values, so a send only blocks once that room is full.Channels
- Capacity
- How many elements a slice can hold before it has to grow into a new, larger array.Slices
- Channel
- A typed pipe between goroutines. One sends, another receives, and the channel handles the synchronization.Channels
- Closure
- A function value that keeps using variables from the scope it was written in, after that scope has returned.Functions
- Comma-ok
- The two-result form of a map read, type assertion, or channel receive. The second result reports whether the first is real.Maps
- Composite literal
- Syntax that builds a struct, slice, array, or map and fills it in one expression.Structs
- Constant expression
- A value computed entirely at compile time. It cannot involve anything decided while the program runs.Constants
- Context
- A value carried through a call chain holding a deadline, a cancellation signal, and request-scoped data.context
- Deadlock
- Every goroutine is blocked waiting on another, so none can proceed and the program stops.Channels
- Defer
- Schedules a call to run when the surrounding function returns, on every path out of it.Defer
- Directed channel
- A channel parameter restricted to sending or receiving only, written chan<- T or <-chan T.Channels
- Embedding
- Placing a type inside a struct with no field name, so the outer type gets the inner one's fields and methods.Structs
- Enum
- A set of named constants of one defined type. Go has no enum keyword, and the compiler does not stop a value outside the set.iota / Enums
- Escape analysis
- The compiler deciding whether a value can live on the stack or must move to the heap.Pointers
- Exported
- An identifier starting with a capital letter, which makes it visible to other packages.
- Format verb
- The placeholder in a format string that says how to print a value, such as %v, %d, or %T.fmt
- Goroutine
- A function running concurrently, scheduled by the Go runtime rather than the operating system.Goroutines
- Iota
- A counter inside a const block. It is zero on the first line and increases by one per line, and it resets in every new block.iota / Enums
- Interface
- A set of method signatures. Any type with those methods satisfies it, with nothing to declare.Interfaces
- Interface satisfaction
- Having every method an interface lists. It is checked by the compiler, never announced in the code.Interfaces
- Label
- A name attached to a statement, so a break or continue can say which loop it means.Goto
- Len
- How many elements a slice, map, string, or channel currently holds.Slices
- Map
- An unordered collection of key-value pairs with constant-time lookup by key.Maps
- Method
- A function with a receiver, which attaches it to a type.Methods / Receivers
- Method set
- Which methods a type has. It decides which interfaces that type satisfies.Interfaces
- Mutex
- A lock that lets one goroutine at a time into a section of code.Mutexes
- Named return
- A result declared with a name in the signature, which the function body can assign to and a deferred call can change.Functions
- Nil
- The zero value of a pointer, slice, map, channel, function, or interface. It means nothing is there yet.Pointers
- Nil map
- A map that was declared but never made. Reading from it works and gives zero values, writing to it panics.Maps
- Package
- The unit of compilation and of visibility. Every Go file declares which package it belongs to.
- Panic
- An unrecovered runtime failure. It unwinds the stack, running deferred calls, and stops the program.Defer
- Parameter
- A variable in a function's signature that receives an argument when the function is called.Functions
- Pointer
- A value holding the memory address of another value, written *T.Pointers
- Pointer receiver
- A method whose receiver is a pointer, so the method can change the value it was called on.Methods / Receivers
- Promotion
- An embedded type's fields and methods becoming reachable directly on the outer struct.Structs
- Race condition
- Two goroutines touching the same memory at the same time with at least one writing. The result depends on timing.Mutexes
- Receiver
- The value a method is called on, declared between func and the method name.Methods / Receivers
- Rune
- One Unicode code point, stored as an int32.Runes
- Runtime
- The Go code shipped inside every binary that schedules goroutines, manages memory, and collects garbage.Concurrency
- Select
- Waits on several channel operations at once and proceeds with whichever is ready first.Select
- Shadowing
- Declaring a new variable with the same name inside an inner block. The outer one is untouched and unreachable there.Variables
- Short declaration
- The := form, which declares a variable and infers its type from the value on the right.Variables
- Slice
- A view onto part of an array, carrying a pointer to the elements, a length, and a capacity.Slices
- Slice header
- The three words a slice value actually is: pointer, length, capacity. Copying a slice copies these, not the elements.Slices
- Stringer
- The interface holding a String() string method. Anything in fmt that prints a value calls it, so a numeric type can print as a name.iota / Enums
- Struct
- A type made of named fields, laid out in memory in the order they are declared.Structs
- Struct tag
- A string literal after a field, read at runtime by packages such as encoding/json to control how the field is handled.Structs
- Switch
- Picks one branch out of several. With no expression after the keyword, each case is its own condition.Switch
- Type assertion
- Pulling a concrete type back out of an interface value, written v.(T).Interfaces
- Type inference
- The compiler working out a variable's type from the value assigned to it.Variables
- Type parameter
- A placeholder type in a generic function or type, filled in at the call site.Generics
- Type switch
- A switch on the dynamic type inside an interface value, written switch v := x.(type).Interfaces
- Unbuffered channel
- A channel with no room. A send waits for a receive, which makes the two goroutines meet.Channels
- Underlying type
- The type a defined type is built from. It decides what operations are allowed and what converts to what.Types
- Value receiver
- A method whose receiver is a copy, so changes inside the method do not reach the original.Methods / Receivers
- Variadic
- A final parameter written ...T, which accepts any number of arguments and arrives as a slice.Functions
- WaitGroup
- A counter that blocks until every goroutine it is tracking has reported itself done.Worker Pools
- Worker pool
- A fixed number of goroutines pulling jobs off one channel, which caps how much runs at once.Worker Pools
- Zero value
- What a variable holds before anything is assigned to it. Never undefined, and different per type.Types