title: Why can't I use conn.ok() from net.go?
body: <p>I'm coming at Golang from a Python background and I am trying to wrap my head around various new concepts.</p>
  
  <p>One thing I have come across is this function in net.go:</p>
  
  <pre><code>func (c *conn) ok() bool { return c != nil &amp;&amp; c.fd != nil }
  </code></pre>
  
  <p>This function is called by multiple net.go methods, e.g. conn.Read:</p>
  
  <pre><code>// Read implements the Conn Read method.
  func (c *conn) Read(b []byte) (int, error) {     
  if !c.ok() {        
      return 0, syscall.EINVAL
  }
  </code></pre>
  
  <p>I am trying to understand how the <code>ok()</code> method can be called on conn, despite the fact that <code>ok()</code> does <strong>not</strong> appear to be an interface of conn.</p>
  
  <p>Certainly I do not seem to be able to call <code>ok()</code> from my client code:</p>
  
  <pre><code>func main() {
  conn, err := net.Dial("tcp", "www.reddit.com:80")
  if err != nil {
      os.Exit(-1)
  }
  fmt.Println(&amp;conn.ok())
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>./server.go:14:22: conn.ok undefined (type net.Conn has no field or method ok)
  </code></pre>
  
  <p>Any pointers appreciated...</p>