What is a Go rune?

yourbasic.org/golang

A rune is a type meant to repre­sent a Unicode code point.

The rune type is an alias for int32, and is used to emphasize than an integer represents a code point.

Strings and UTF-8

Note that a string is a sequence of bytes, not runes.

However, strings often contain Unicode text encoded in UTF-8, which encodes all Unicode code points using one to four bytes. Since Go source code itself is encoded as UTF-8, string literals will automatically get this encoding.

Further reading

String functions cheat sheet

Share this page: