.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.1.1 / staticcheck / testdata / src / CheckConcurrentTesting / CheckConcurrentTesting.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.1.1/staticcheck/testdata/src/CheckConcurrentTesting/CheckConcurrentTesting.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.1.1/staticcheck/testdata/src/CheckConcurrentTesting/CheckConcurrentTesting.go
new file mode 100644 (file)
index 0000000..d0c3ab1
--- /dev/null
@@ -0,0 +1,37 @@
+package pkg
+
+import "testing"
+
+func fn1() {
+       var t *testing.T
+       go func() { // want `the goroutine calls T\.Fatal, which must be called in the same goroutine as the test`
+               t.Fatal()
+       }()
+       go fn2(t) // want `the goroutine calls T\.Fatal, which must be called in the same goroutine as the test`
+
+       fn := func() {
+               t.Fatal()
+       }
+       go fn() // want `the goroutine calls T\.Fatal, which must be called in the same goroutine as the test`
+}
+
+func fn2(t *testing.T) {
+       t.Fatal()
+}
+
+func fn3(t *testing.T) {
+       fn := func() {
+               t.Fatal()
+       }
+       fn()
+}
+
+func fn4(t *testing.T) {
+       t.Fatal()
+}
+
+func fn5(t *testing.T) {
+       func() {
+               t.Fatal()
+       }()
+}