title: Using Mutex lock - still deadlock
body: <p>I am playing around with Goroutines and channels and wonder why I got the error in the title.<br>
  The idea is that I have one global int channel that gets incremented per routing.<br>
  By using the mutex lock I expected the channel to be locked per routine but that failed.<br>
  The code is here: </p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "sync"
  )
  
  var number = make(chan int)
  var mutex = &amp;sync.Mutex{}
  
  func worker(wg *sync.WaitGroup, id int) {
      defer wg.Done()
  
      mutex.Lock()
      number &lt;- id + &lt;-number
      mutex.Unlock()
  }
  
  func main() {
      var wg sync.WaitGroup
      number &lt;- 0
      for i := 0; i &lt; 5; i++ {
          wg.Add(1)
          go worker(&amp;wg, i)
      }
  
      wg.Wait()
      fmt.Println(&lt;-number) // expected output: 0+1+2+3+4 = 10
  }
  </code></pre>
  
  <p><a href="https://play.golang.org/p/P5P9Bf5ZSIP" rel="nofollow noreferrer">https://play.golang.org/p/P5P9Bf5ZSIP</a></p>