title: Function implementing interface
body: <p>I want to know what is happening here.</p>
  
  <p>There is the interface for a http handler:</p>
  
  <pre><code>type Handler interface {
      ServeHTTP(*Conn, *Request)
  }
  </code></pre>
  
  <p>This implementation I think I understand.</p>
  
  <pre><code>type Counter int
  
  func (ctr *Counter) ServeHTTP(c *http.Conn, req *http.Request) {
      fmt.Fprintf(c, "counter = %d\n", ctr);
      ctr++;
  }
  </code></pre>
  
  <p>From my understanding it is that the type "Counter" implements the interface since it has a method that has the required signature. So far so good. Then this example is given:</p>
  
  <pre><code>func notFound(c *Conn, req *Request) {
      c.SetHeader("Content-Type", "text/plain;", "charset=utf-8");
      c.WriteHeader(StatusNotFound);
      c.WriteString("404 page not found\n");
  }
  
  // Now we define a type to implement ServeHTTP:
  type HandlerFunc func(*Conn, *Request)
  func (f HandlerFunc) ServeHTTP(c *Conn, req *Request) {
      f(c, req) // the receiver's a func; call it
  }
  // Convert function to attach method, implement the interface:
  var Handle404 = HandlerFunc(notFound);
  </code></pre>
  
  <p>Can somebody elaborate on why or how these various functions fit together?</p>