title: Using an interface within a struct in Go
body: <p>In trying to understand Go, I ran into this piece of code in <code>websocket.go</code> (snipped):</p>
  
  <pre><code>type frameHandler interface {
      HandleFrame(frame frameReader) (r frameReader, err error)
      WriteClose(status int) (err error)
  }
  
  // Conn represents a WebSocket connection.
  type Conn struct {
      config  *Config
      request *http.Request
      .
      .
      frameHandler
      PayloadType        byte
      defaultCloseStatus int
  }
  </code></pre>
  
  <p>In the Conn type the <code>frameHandler</code> stands there all alone? An interface without a name?
  Later on in the code they even try check if the poor interface is nil:</p>
  
  <pre><code>Conn(a).frameHandler == nil
  </code></pre>
  
  <p>My own guess is that the <code>frameHandler</code> within the struct is a type which matches the frameHandler interface, and on top of that will have the name <code>frameHandler</code>. Is this correct? Hehe, fun language anyhow.</p>