title: Handling panics in go routines
body: <p>I understand that to handle panic recover is used. But the following block fails to recover when panic arises in go routine</p>
  
  <pre><code>func main() {
      done := make(chan int64)
      defer fmt.Println("Graceful End of program")
      defer func() {
       r := recover()
       if _, ok := r.(error); ok {
          fmt.Println("Recovered")
       }
      }()
  
      go handle(done)
      for {
          select{
          case &lt;- done:
          return
          }
      } 
  }
  
  func handle(done chan int64) {
      var a *int64
      a = nil
  
      fmt.Println(*a)
      done &lt;- *a
  }
  </code></pre>
  
  <p>However following block is able to execute as expected</p>
  
  <pre><code>func main() {
      done := make(chan int64)
      defer fmt.Println("Graceful End of program")
      defer func() {
       r := recover()
       if _, ok := r.(error); ok {
          fmt.Println("Recovered")
       }
      }()
  
      handle(done)
      for {
          select{
          case &lt;- done:
          return
          }
      } 
  }
  
  func handle(done chan int64) {
      var a *int64
      a = nil
  
      fmt.Println(*a)
      done &lt;- *a
  }
  </code></pre>
  
  <p>How to recover from panics that arise in go routines. Here is the link for playground : <a href="https://play.golang.org/p/lkvKUxMHjhi" rel="noreferrer">https://play.golang.org/p/lkvKUxMHjhi</a></p>