Types#
Go is statically typed with a small set of primitives, composites (array, slice, map, struct, channel, function, pointer), and structurally satisfied interfaces. Type conversion is always explicit; the compiler never coerces silently.
For literals see Syntax. For methods and interfaces, see OOP.
Primitives#
bool, int family, uint family, byte,
rune, float32 / float64, complex.
Immutable UTF-8; bytes vs runes; strings.Builder.
Explicit conversions; strconv, fmt.Sprintf.
Composites#
Fixed-size; [N]T is the type.
Header over a backing array; append, copy,
len, cap.
Unordered key-value containers; make, delete,
comma-ok lookup.
Records; named fields; anonymous form.
*T / &x; no pointer arithmetic.
Structural satisfaction; any; type assertion / switch.
chan T; send-only and receive-only directions.
Functions as values typed by signature.
User-defined#
type Name underlying; nominal branding.
Type parameters (1.18+); cmp.Ordered.
References#
Syntax for the literal forms.
Operators for conversions and comparison semantics.
OOP for methods, interfaces, embedding.
Concurrency for channels and the
selectsurface.