Member-only story
Go Types Explained: Why Numbers Need Conversion and Strings Count Bytes
A practical guide to integer conversions, floating-point precision, and the difference between bytes, runes, and characters.
A number looks like a number. A string looks like text. Then you start learning Go, and two small examples challenge those assumptions.
Assigning an int16 variable to an int32 variable fails to compile. Calling len("čau") returns 4, even though you can see three letters.
💡 Fun fact: “Čau” means “hi” in Czech — and you can also use it to say “bye.” Three letters, four bytes in UTF-8, and two meanings. Pretty efficient for such a small word!
Both results become predictable once you understand how Go represents values. These details matter when you move beyond tutorial inputs and start handling numeric boundaries, international names, and real application data.
The snippets below belong inside a main function. Examples using fmt or utf8 require imports for fmt or unicode/utf8, respectively.
Why Go asks you to convert numbers explicitly
Consider two integer variables:
var small int16 = 42
var large int32
// large = small // Compile error
large…









