Skip to content

testing-fatal-in-goroutine

Detect test termination methods called from child goroutines.

Updated View as Markdown

Default severity: error

Methods on testing.T and testing.B that terminate or skip execution must run in the same goroutine as the test. Calling Fatal, FailNow, Skip, or related methods from a child goroutine does not stop the test correctly.

Bad

go func() { t.Fatal("failed") }()

Good

if err := work(); err != nil { t.Fatal(err) }
Navigation

Type to search…

↑↓ navigate↵ selectEsc close