Immutable strings are a useful language feature. For one thing, it makes them usable as map keys, without having to duplicate the entire contents.
A copy-by-value is cheap (it copies only the pointer and length): b := a ... but you know that there are never any issues around aliasing, e.g. if you pass a string to a function the caller will never see it mutate unexpectedly. You can think of it as making string values behave the same as you'd expect from numeric values. If you want a mutable string, look at []byte instead, and read the excellent intro to slices at https://blog.golang.org/slices -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/13963bd1-bab9-4165-a775-e9c290676c73o%40googlegroups.com.