Strings
Strictly speaking, a string in Go is not a composite type, but there are so many Go functions that support strings that I decided to describe strings in more detail in this chapter.
As discussed in Chapter 3, Working with Basic Go Data Types, strings in Go are value types, not pointers as is the case with C strings. Additionally, Go supports UTF-8 strings by default, which means that you do not need to load any special packages or do anything tricky in order to print Unicode characters. However, there are subtle differences between a character, a rune, and a byte, as well as differences between a string and a string literal, which are going to be clarified here.
A Go string is a read-only byte slice that can hold any type of bytes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access