title: Goroutines with ListenAndServe increases performance?
body: <p>I'm not very familiar with Go's routines but since I'm working with the router of <code>net/http</code> I saw a few times that<code>ListenAndServe()</code> is wrapped by a go routine.</p>
  
  <p>A server needs to be able to handle multiple requests simultaneously out of the box to be efficient. So why are go routines as 'lightweight threads' used?
  Does the concurrency provide any advantages?</p>
  
  <p>Here's an example by <a href="https://github.com/openshift/origin/blob/67ef8497bbcd4f7ea8bc4e0e2daa75ba0c613f20/examples/hello-openshift/hello_openshift.go" rel="noreferrer">OpenShift</a>
  </p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "net/http"
  )
  
  func helloHandler(w http.ResponseWriter, r *http.Request) {
      fmt.Fprintln(w, "Hello OpenShift!")
  }
  
  func main() {
      http.HandleFunc("/", helloHandler)
  
      go func() {
          fmt.Println("serving on 8080")
          err := http.ListenAndServe(":8080", nil)
          if err != nil {
              panic("ListenAndServe: " + err.Error())
          }
      }()
  
      go func() {
          fmt.Println("serving on 8888")
          err := http.ListenAndServe(":8888", nil)
          if err != nil {
              panic("ListenAndServe: " + err.Error())
          }
      }()
      select {}
  }
  </code></pre>