---
title: "no-naked-return"
description: "Require explicit values when returning from named-result functions."
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.

# no-naked-return

**Default severity:** `warning`

Reports a bare `return` when the nearest function declaration or function
literal has at least one named result. Naked returns make data flow implicit:
the reader must search backward to determine which values are returned.

## Bad

```go
func value() (result int) {
	result = calculate()
	return
}
```

## Good

```go
func value() (result int) {
	result = calculate()
	return result
}
```

The rule does not require removing named results. It only requires the return
statement to name the values being returned.

## Configuration

```toml
[checks.no-naked-return]
severity = "warning"
excludes = ["generated/**"]
```

Source: https://strider.gempir.com/lints/no-naked-return/index.mdx
