GoGo

Go glossary – key terms explained

Channel

Typed conduit for exchanging values between goroutines; unbuffered (synchronous) or buffered.

Constraint

Interface that restricts which types a type parameter may take (e.g. cmp.Ordered).

context

Package that carries cancellation signals, deadlines and values through call chains and goroutines.

defer

Postpones a call until the end of the surrounding function; multiple ones run in reverse order.

Embedding

Embedding a type in a struct: fields and methods are promoted – composition instead of inheritance.

Generics

Type parameters ([T any]) for functions and types, since Go 1.18.

gofmt

Official formatting tool (go fmt); ensures a uniform style without debates.

Goroutine

Lightweight thread of execution managed by the Go runtime; started with go f().

Interface

Set of method signatures; types satisfy it implicitly without declaring it.

Module

A project with a go.mod that defines the module path, Go version and dependencies.

Mutex

Lock (sync.Mutex) that restricts a critical section to one goroutine at a time.

Package

Folder of .go files sharing the same package line; the smallest unit of reuse and visibility.

panic / recover

Mechanism for severe programming errors: panic aborts, recover catches in a deferred function.

Receiver

The parameter before the method name (func (k *Konto) ...) that binds the method to a type.

rune

Alias for int32: a Unicode character (code point). Strings consist of UTF-8 bytes, runes are individual characters.

select

Statement that waits on several channel operations at once and executes the ready case.

Slice

Dynamic view onto an array made of a pointer, length and capacity; Go's default type for lists.

Struct Tag

Metadata in backticks after a field (e.g. json:"name") that packages such as encoding/json evaluate.

WaitGroup

Counter from the sync package used to wait for several goroutines to finish.

Zero Value

Automatic default value of a type without initialization: 0, "", false or nil.