<p>I'm guessing this is an incredibly basic question - my apologies for asking, but I'm having trouble figuring this out after Googling and going through pages.</p>
<p>I see "writes to w" a lot on this official Golang page: <a href="https://golang.org/pkg/fmt/" rel="nofollow">https://golang.org/pkg/fmt/</a></p>
<p>Example:</p>
<blockquote>
<p>Fprint formats using the default formats for its operands and writes to w.</p>
</blockquote>
<p>What does that mean? Thanks.</p>
<hr/>**评论:**<br/><br/>tv64738: <pre><blockquote>
<p>func Fprint(<strong>w</strong> io.Writer, a ...interface{}) (n int, err error)</p>
<p>Fprint formats using the default formats for its operands and writes to w.</p>
</blockquote></pre>_nefario_: <pre><p>w in this case is something that implements the <a href="https://golang.org/pkg/io/#Writer" rel="nofollow">io.Writer interface</a>, so it has a Write method. when they say "write to w", they mean call the Write method</p></pre>stoned_phillips: <pre><p>Ah, I see. Cool. Thanks!</p></pre>natefinch: <pre><p>Just to clarify further... w is the name of one of the arguments. Go documentation often does this, where it will refer to arguments by name with no other context. Once you get used to it, it's nice, because it avoids having the javadoc thing where you have to define the argument but then the description is just useless.</p>
<p>// @param w the io.Writer to write to</p></pre>de_joerg: <pre><p>Its expecting an instance that have an implemented Writer interface:
<code>type Writer interface {
Write(p []byte) (n int, err error)
}</code></p>
<p>An instance will read the stream of p []byte and will write it into a sink, e.g. buffer, terminal, memory.</p></pre>
