如何在Go程序中内部存储文本?

Software should only work with Unicode strings internally, converting to a particular encoding on output.

-- Python Docs

The above quote is from the Python docs. Python has a unicode string type so this makes sense. Go doesn't have unicode strings. As strings are just an immutable byte slice. What would be the equivalent quote for Go?

Would it be to convert text to utf-8 on entry to the program and store as utf-8 internally, and then output utf-8?

Generally speaking, in Go you will be writing a []byte like when using the ioutil package's WriteFile method; https://golang.org/pkg/io/ioutil/#WriteFile

So yes, the answer is that you explicitly declare the encoding. Since the string is just a byte slice, there is no inherent encoding, however string literals in Go source will be UTF-8. If you haven't already read this Go blog post by Robert Pike on strings, bytes and runes, it's worth the time; https://blog.golang.org/strings