shad-go/lectures/04-testing/race/race_test.go
Fedor Korotkiy dccd98c578 Fixes
2020-03-19 16:06:26 +03:00

23 lines
235 B
Go

package race
import (
"sync"
"testing"
)
func TestRace(t *testing.T) {
var wg sync.WaitGroup
defer wg.Wait()
wg.Add(2)
var i int
go func() {
defer wg.Done()
i = 0
}()
go func() {
defer wg.Done()
i = 1
}()
_ = i
}