Actually, the issue mentioned by the OP is covered here:<p><a href="http:&#x2F;&#x2F;golang.org&#x2F;doc&#x2F;faq#nil_error" rel="nofollow">http:&#x2F;&#x2F;golang.org&#x2F;doc&#x2F;faq#nil_error</a><p>Basically, if you pass &#x27;nil&#x27; of one type into an argument which accepts an interface of another type, the nil is no longer nil, but an interface wrapper around a nil (which is not nil).<p>So:<p><pre><code>    var buf *bufio.Reader &#x2F;&#x2F; a nil value
</code></pre>
if this is passed into a function with a signature of<p><pre><code>    func foo(buf io.Reader)
</code></pre>
then when in function foo:<p><pre><code>    foo(buf) &#x2F;&#x2F; valid, and buf is nil here

    &#x2F;&#x2F;inside foo:

    if buf != nil { &#x2F;&#x2F; but buf is not nil here, so this is true
        buf.Read() &#x2F;&#x2F; Panics because nil has no function Read.</code></pre>