---
title: "deferred-return-function-not-called"
description: "Detect deferred setup calls whose returned function is not called."
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-return-function-not-called

**Default severity:** `warning`

Functions sometimes perform setup immediately and return a function that
performs cleanup. Deferring only the first call delays setup until function
exit and then discards the returned cleanup function.

## Bad

```go
defer setup()
```

## Good

```go
defer setup()()
```

Source: https://strider.gempir.com/analyzers/deferred-return-function-not-called/index.mdx
