| 1 |
package pkg |
| 2 |
|
| 3 |
import "testing" |
| 4 |
|
| 5 |
func fn1() { |
| 6 |
var t *testing.T |
| 7 |
go func() { //@ diag(`the goroutine calls T.Fatal, which must be called in the same goroutine as the test`) |
| 8 |
t.Fatal() |
| 9 |
}() |
| 10 |
go fn2(t) //@ diag(`the goroutine calls T.Fatal, which must be called in the same goroutine as the test`) |
| 11 |
|
| 12 |
fn := func() { |
| 13 |
t.Fatal() |
| 14 |
} |
| 15 |
go fn() //@ diag(`the goroutine calls T.Fatal, which must be called in the same goroutine as the test`) |
| 16 |
} |
| 17 |
|
| 18 |
func fn2(t *testing.T) { |
| 19 |
t.Fatal() |
| 20 |
} |
| 21 |
|
| 22 |
func fn3(t *testing.T) { |
| 23 |
fn := func() { |
| 24 |
t.Fatal() |
| 25 |
} |
| 26 |
fn() |
| 27 |
} |
| 28 |
|
| 29 |
func fn4(t *testing.T) { |
| 30 |
t.Fatal() |
| 31 |
} |
| 32 |
|
| 33 |
func fn5(t *testing.T) { |
| 34 |
func() { |
| 35 |
t.Fatal() |
| 36 |
}() |
| 37 |
} |