Source file src/cmd/vendor/golang.org/x/tools/go/analysis/passes/testinggoroutine/doc.go
1 // Copyright 2023 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Package testinggoroutine defines an Analyzerfor detecting calls to 6 // Fatal from a test goroutine. 7 // 8 // # Analyzer testinggoroutine 9 // 10 // testinggoroutine: report calls to (*testing.T).Fatal from goroutines started by a test 11 // 12 // Functions that abruptly terminate a test, such as the Fatal, Fatalf, FailNow, and 13 // Skip{,f,Now} methods of *testing.T, must be called from the test goroutine itself. 14 // This checker detects calls to these functions that occur within a goroutine 15 // started by the test. For example: 16 // 17 // func TestFoo(t *testing.T) { 18 // go func() { 19 // t.Fatal("oops") // error: (*T).Fatal called from non-test goroutine 20 // }() 21 // } 22 package testinggoroutine 23