Common Mistakes for New Golang Devs
One of the most common mistakes new Go developers make are creating race conditions.<p>For example, the author's final example. (And maybe others, I didn't read them all.)<p><pre><code>  $ go run -race racy.go
  ==================
  WARNING: DATA RACE
  Write at 0x00c42009800f by goroutine 6:
    main.main.func1()
        /home/eric/racy.go:12 +0x38
  
  Previous read at 0x00c42009800f by main goroutine:
    main.main()
        /home/eric/racy.go:15 +0x8b
  
  Goroutine 6 (running) created at:
    main.main()
        /home/eric/racy.go:11 +0x76
  ==================
  done!
  Found 1 data race(s)
  exit status 66
</code></pre>
edit: add code listing<p><pre><code>  package main
  
  import (  
      "fmt"
      "runtime"
  )

  func main() {  
      done := false
  
      go func(){
          done = true
      }()
  
      for !done {
          runtime.Gosched()
      }
      fmt.Println("done!")
  }</code></pre>