title: Different behavior when printing a bytes.Buffer in Go
body: <p>When I execute this:</p>
  
  <pre><code>buf := new(bytes.Buffer)
  buf.WriteString("Hello world")
  fmt.Println(buf)
  </code></pre>
  
  <p>it prints <code>Hello World</code>.</p>
  
  <p>But if I execute this:</p>
  
  <pre><code>var buf bytes.Buffer
  buf.WriteString("Hello world")
  fmt.Println(buf)
  </code></pre>
  
  <p>it prints: <code>{[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}</code></p>
  
  <p>I understand that this is the content of the structure <a href="https://golang.org/src/bytes/buffer.go?s=402:817#L7" rel="nofollow noreferrer">byte.Buffer</a> but why it is printed in a different format?</p>