When I execute this:
buf := new(bytes.Buffer)
buf.WriteString("Hello world")
fmt.Println(buf)
it prints Hello World.
But if I execute this:
var buf bytes.Buffer
buf.WriteString("Hello world")
fmt.Println(buf)
it prints: {[72 101 108 108 111 32 119 111 114 108 100] 0 [72 101 108 108 111 32 119 111 114 108 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] 0}
I understand that this is the content of the structure byte.Buffer but why it is printed in a different format?