title: Anonymous function doesn't seem to execute in Go routine
body: <p>I have the following code. Pay special attention to the anonymous function:</p>
  
  <pre><code>func saveMatterNodes(matterId int, nodes []doculaw.LitigationNode) (bool, error) {
  
      var (
          err  error
          resp *http.Response
      )
  
      // Do this in multiple threads
      for _, node := range nodes {
          fmt.Println("in loops")
          go func() {
              postValues := doculaw.LitigationNode{
                  Name:        node.Name,
                  Description: node.Description,
                  Days:        node.Days,
                  Date:        node.Date,
                  IsFinalStep: false,
                  Completed:   false,
                  Matter:      matterId}
  
              b := new(bytes.Buffer)
              json.NewEncoder(b).Encode(postValues)
              resp, err = http.Post("http://127.0.0.1:8001/matterNode/", "application/json", b)
              io.Copy(os.Stdout, resp.Body)
  
              fmt.Println("Respone from http post", resp)
              if err != nil {
                  fmt.Println(err)
              }
          }()
  
      }
  
      if err != nil {
          return false, err
      } else {
          return true, nil
      }
  
  }
  </code></pre>
  
  <p>If I remove the <code>go func() {}()</code> part and just leave the code in between it seems to execute fine but the moment I add it back it does not execute. Any idea why that is? I initially thought maybe because it's executing on a different thread but this doesn't seem to be the case as I can see on my webservice access logs that it is not executing.</p>