title: Why Go's channel can close twice?
body: <p>When I am do some go practices code, I encounter a problem that a channel can be closed twice like this:</p>
  
  <pre><code>// jobs.go
  
  package main
  
  import (
     "fmt"
  )
  
  func main() {
      fmt.Println("Hello, playground")
      jobs := make(chan int, 5)
      done := make(chan bool)
  
      go func() {
          for {
              j,more := &lt;-jobs
  
              fmt.Println("receive close: ", j, more)
              done &lt;- true   
          }
      }()
  
      close(jobs)
      &lt;- done
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>~ go run jobs.go
  Hello, playground
  receive close:  0 false
  receive close:  0 false
  </code></pre>
  
  <p>But when I close the channel twice manually, I got <code>panic: close of closed channel</code>. </p>
  
  <p>Why the code above can receive close  twice?</p>