title: golang address of interface and interface difference
body: <p>I have found many similar problem, but not what I want
  please see following codes.</p>
  
  <p>(1)</p>
  
  <pre><code>var buf bytes.Buffer
  fmt.Fprint(&amp;buf,"test")
  </code></pre>
  
  <p>(2)                         </p>
  
  <pre><code>var w http.ResponseWriter
  http.Error(w,http.StatusText(http.StatusBadRequest),http.StatusBadRequest)
  </code></pre>
  
  <p>both http.ResponseWriter and bytes.Buffer implement io.Writer interface, so I think they should have same behavior.</p>
  
  <p>when I change to </p>
  
  <pre><code>http.Error(&amp;w,http.StatusText(http.StatusBadRequest),http.StatusBadRequest)
  </code></pre>
  
  <p>jetbrains goland tell me</p>
  
  <pre><code>Cannot use '&amp;w' (type *http.ResponseWriter) as type ResponseWriter
  </code></pre>
  
  <p>I wonder why <code>buf</code> have '&amp;' can works, but another don't work?</p>
  
  <p>I googled, somebody say when pass value to function, it can reference to <code>&amp;w</code></p>
  
  <p>but another say if you pass a pointer, it can deference to value</p>
  
  <p>from <a href="https://github.com/golang/go/wiki/MethodSets#variables" rel="nofollow noreferrer">https://github.com/golang/go/wiki/MethodSets#variables</a></p>
  
  <blockquote>
    <p>To make it easier to remember these rules, it may be helpful to simply consider the pointer- and value-receiver methods separately from the method set. It is legal to call a pointer-valued method on anything that is already a pointer or whose address can be taken (as is the case in the above example). It is legal to call a value method on anything which is a value or whose value can be dereferenced (as is the case with any pointer; this case is specified explicitly in the spec).</p>
  </blockquote>
  
  <p>I am totally confused, I can't understand by myself.
  I wish you can help me, thank you!</p>