---
title: "deferred-recover-call"
description: "Defer a function that calls recover instead of deferring recover directly."
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.

# deferred-recover-call

**Default severity:** `error`

`recover` only stops a panic when it is called from a deferred function. A
direct `defer recover()` evaluates `recover` while scheduling the defer, so it
cannot recover the later panic.

## Bad

```go
defer recover()
```

## Good

```go
defer func() {
	_ = recover()
}()
```

Source: https://strider.gempir.com/lints/deferred-recover-call/index.mdx
