Rune
A rune is Go’s predeclared alias for int32 that represents a Unicode code point.
100 Go Mistakes and How to Avoid Them
A rune is Go's representation of a Unicode code point, implemented as an alias of int32.
- How it is used
- Prevents byte-versus-code-point mistakes when counting, indexing, or iterating over Go strings.
- How deep it goes
- Defines rune and traces incorrect iteration through its output, then compares range values, rune slices, and UTF-8 rune counting.
- Examples
- Contrasts the three-byte `汉` with loops over `hêllo` that print a byte, a rune, or rune-slice positions.
- What you can do after
- Diagnose/debug with it: distinguish byte lengths and offsets from rune counts and positions, then select the appropriate iteration or conversion.
Read how 100 Go Mistakes and How to Avoid Them explains rune →
Go in Practice, Second Edition
A rune is Go's integer type for representing a Unicode code point.
- How it is used
- Uses runes to make string processing handle multibyte, non-ASCII characters correctly.
- How deep it goes
- Defines the Unicode-code-point type and demonstrates conversion to []rune, stopping short of deeper Unicode internals.
- Examples
- Demonstrates reversing an ASCII name and a name containing a non-ASCII character, then validating the fix with go test.
- What you can do after
- Diagnose and fix character-processing bugs by converting strings to rune slices before character-wise operations.
Learn Go with Pocket-Sized Projects
A rune is Go's value type representing a single Unicode code point.
- How it is used
- Uses runes to represent individual Unicode code points and inspect multilingual strings.
- How deep it goes
- Defines rune literals and demonstrates iteration, then stops short of treating grapheme-like character units as native runes.
- Examples
- Uses '學', multilingual greetings, and the नमस्त string to contrast rune literals, strings, and combining marks.
- What you can do after
- Apply rune literals and []rune iteration, or choose Unicode normalization when code points do not match desired character units.
Read how Learn Go with Pocket-Sized Projects explains rune →
Go in Action, Second Edition
A rune is Go's alias for int32 that represents a Unicode code point independently of its encoded representation.
- How it is used
- Uses rune for Unicode-aware string iteration, character comparison, conversion, and inspection.
- How deep it goes
- Defines the int32 alias, demonstrates range and []rune conversion, and applies Unicode packages without detailing their full APIs.
- Examples
- Demonstrates 地鼠 iteration, []rune indexing, and À classification, case conversion, and encoded-length inspection.
- What you can do after
- Apply it via range loops and Unicode packages to process, classify, compare, and inspect characters.
Related concepts
- code pointequivalent to · A code point is a numeric value assigned by a character-representation standard to identify an abstract character or symbol.
- int32kind of · An int32 is a signed integer type represented using exactly 32 bits.
- bytescontrasts with · Bytes are an ordered sequence of values, each conventionally eight bits, used to represent binary data.
- range loopused by · A range loop is a Go for-loop form that iterates over values or entries produced by a supported rangeable expression.
- slicingpart of · Slicing selects or partitions a portion of an indexed sequence or multidimensional array, often along specified indices or dimensions.
- byte typecontrasts with · A byte type is a fixed-width integer type occupying eight bits, with signedness and numeric range determined by the language.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



