For my application, it does not matter if the string is human readable or not.
Attaching a String() function to a named struct allows us to convert a struct to a string.
package main
import "fmt"
type foo struct {
bar string
}
func (f foo) String() string {
return fmt.Sprintf("Foo Says: %s", f.bar)
}
func main() {
fmt.Println(foo{"Hello World!"})
}
output:
Foo Says: Hello World!