title: How an os.Signal channel is handled internally in Go?
body: <p>When having the code:</p>
  
  <pre class="lang-golang prettyprint-override"><code>package main
  
  import (
      "os"
      "os/signal"
  )
  
  func main() {
      sig := make(chan os.Signal, 1)
      signal.Notify(sig)
      &lt;-sig
  }
  </code></pre>
  
  <p>Runs without problem, of course, blocking until you send a signal that interrupts the program.</p>
  
  <p>But:</p>
  
  <pre class="lang-golang prettyprint-override"><code>package main
  
  func main() {
      sig := make(chan int, 1)
      &lt;-sig
  }
  </code></pre>
  
  <p>throws this error:</p>
  
  <pre><code>fatal error: all goroutines are asleep - deadlock!
  
  goroutine 1 [chan receive]:
  main.main()
      /home/user/project/src/main.go:5 +0x4d
  exit status 2
  </code></pre>
  
  <p>While I understand why reading from the <code>int</code> channel causes a deadlock, I have only a suspicion
  that the <code>os.Signal</code> doesn't because its channel can suffer writes from "the outside" as, well,
  it handles signals and they come from outside the program. </p>
  
  <p>Is my suspicion somewhat correct? If so, how the runtime handles this differently from other channel types?</p>
  
  <p>Thank you!</p>