4 ms·
Ask Go Language Design: Why were Golang Strings designed to be arbitrary bytes?
Why were Golang Strings designed to be arbitrary bytes? Why not hold Unicode text or UTF-8 text? Rust made the decision that a String is stored as a vector of bytes guaranteed to always be a valid UTF-8.
https://go.dev/blog/strings discusses this feature, but not the decision that lead to this design.
- verdverm 5y agoProbably closeness to C. Note you can iterate over a string to get runes
- justinzollars 5y ago* in the case of range, not a for loop