On Sun, Feb 12, 2017 at 11:51 AM Srivathsan Madhavan <m.srivath...@gmail.com>
wrote:

A race detector should complain about write to i here

        for i := 0; i < 5; i++ {

concurrently with reading i here

        log.Println("i=", i)

Passing i to the goroutine, instead of sharing it should fix the issue

        go func(i int) {
                log.Println("i=", i)
        }(i)


-- 

-j

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to