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
- Uses runes to avoid byte-counting and indexing mistakes when working with Go strings.
- How deep it goes
- Explains code points and UTF-8 encoding, then traces byte offsets and contrasts range iteration with rune-slice indexing.
- Examples
- Uses 汉 to contrast a code point with its UTF-8 bytes and "hêllo" to expose iteration and counting errors.
- What you can do after
- Diagnose/debug string iteration and apply rune counting or slice conversion to access the intended values.
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.
What to know first
- UnicodeUnicode is a standard that assigns code points and properties to characters and defines encoding forms for representing text digitally.
- GoGo is a statically typed, compiled, general-purpose programming language with garbage collection and built-in support for concurrency.
- int32An int32 is a 32-bit integer type or value, conventionally interpreted as a signed integer in programming languages that define signedness.
- stringA string is a programming-language value representing textual data as an ordered sequence of characters or encoded units.
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 32-bit integer type or value, conventionally interpreted as a signed integer in programming languages that define signedness.
- range loopused by · A range loop is a Go for-loop form that iterates over values or entries produced by a supported rangeable expression.
- bytescontrasts with · Bytes are an ordered sequence of byte values, typically eight-bit units, used to represent binary data.
- 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.
Questions about rune
What is rune?
A rune is Go’s predeclared alias for int32 that represents a Unicode code point.
Which Manning books explain rune?
100 Go Mistakes and How to Avoid Them, Go in Practice, Second Edition, Learn Go with Pocket-Sized Projects and Go in Action, Second Edition.
What should I know before learning rune?
Manning books that teach rune usually introduce Unicode, Go, int32 and string first.
What is the difference between rune and bytes?
A rune is Go’s predeclared alias for int32 that represents a Unicode code point. Bytes are an ordered sequence of byte values, typically eight-bit units, used to represent binary data.
What is rune a kind of?
Rune is a kind of int32. An int32 is a 32-bit integer type or value, conventionally interpreted as a signed integer in programming languages that define signedness.
What is rune part of?
Rune is part of slicing. Slicing selects or partitions a portion of an indexed sequence or multidimensional array, often along specified indices or dimensions.
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.



