github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/staticcheck/testdata/src/CheckConcurrentTesting/CheckConcurrentTesting.go (about) 1 package pkg 2 3 import "testing" 4 5 func fn1() { 6 var t *testing.T 7 t.Fatal() 8 go func() { // MATCH /the goroutine calls T.Fatal, which must be called in the same goroutine as the test/ 9 t.Fatal() 10 }() 11 go fn2(t) // MATCH /the goroutine calls T.Fatal, which must be called in the same goroutine as the test/ 12 func() { 13 t.Fatal() 14 }() 15 16 fn := func() { 17 t.Fatal() 18 } 19 fn() 20 go fn() // MATCH /the goroutine calls T.Fatal, which must be called in the same goroutine as the test/ 21 } 22 23 func fn2(t *testing.T) { 24 t.Fatal() 25 }