title: Go func call confusion
body: <p>In this bit of code:</p>
  
  <pre><code>handler := func(w http.ResponseWriter, r *http.Request) {
      io.WriteString(w, "&lt;html&gt;&lt;body&gt;Hello World!&lt;/body&gt;&lt;/html&gt;")
  </code></pre>
  
  <p>}</p>
  
  <p>What is the <code>func</code> keyword doing? I've been reading through the Tour of Go and I'm confused as to what is going on here. </p>
  
  <p>EDITED: Added import list and function that it was apart of </p>
  
  <p>It's part of a function here:</p>
  
  <pre><code>func ExampleResponseRecorder() {
  handler := func(w http.ResponseWriter, r *http.Request) {
      io.WriteString(w, "&lt;html&gt;&lt;body&gt;Hello World!&lt;/body&gt;&lt;/html&gt;")
  }
  
  req := httptest.NewRequest("GET", "http://example.com/foo", nil)
  w := httptest.NewRecorder()
  handler(w, req)
  
  resp := w.Result()
  body, _ := ioutil.ReadAll(resp.Body)
  
  fmt.Println(resp.StatusCode)
  fmt.Println(resp.Header.Get("Content-Type"))
  fmt.Println(string(body))
  
  // Output:
  // 200
  // text/html; charset=utf-8
  // &lt;html&gt;&lt;body&gt;Hello World!&lt;/body&gt;&lt;/html&gt;
   }
  
  import (
  "fmt"
  "io"
  "io/ioutil"
  "log"
  "net/http"
  "net/http/httptest"
  )
  </code></pre>