---
title: "testing-fatal-in-goroutine"
description: "Detect test termination methods called from child goroutines."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# testing-fatal-in-goroutine

**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
go func() { t.Fatal("failed") }()
```

## Good

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

Source: https://strider.gempir.com/analyzers/testing-fatal-in-goroutine/index.mdx
