title: Get an io.ByteReader from a net.Conn
body: <p>I am connecting to a TCP/IP server using Go code similar to:</p>
  
  <pre><code>conn, err := net.Dial("tcp", host+":"+strconv.Itoa(port))
  </code></pre>
  
  <p>Now I need to use <a href="http://golang.org/pkg/encoding/binary/#ReadVarint" rel="noreferrer">binary.ReadVariant</a> which takes an io.ByteReader, so trying to write code like this:</p>
  
  <pre><code>var length int64
  var err error
  length, err = binary.ReadVarint(conn)
  </code></pre>
  
  <p>Gives me an error like:</p>
  
  <pre><code>./main.go:67: cannot use conn (type net.Conn) as type io.ByteReader in function argument:
      net.Conn does not implement io.ByteReader (missing ReadByte method)
  </code></pre>
  
  <p>How can I make this work?</p>