---
title: "prefer-fmt-errorf"
description: "Replace errors.New around fmt.Sprintf."
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.

# prefer-fmt-errorf

<!-- Code generated by docs/scripts/generate-check-docs.go; DO NOT EDIT. -->

**Default severity:** `warning`

Replace errors.New around fmt.Sprintf.

## Bad

```go
errors.New(fmt.Sprintf("load %s", name))
```

## Good

```go
fmt.Errorf("load %s", name)
```

Source: https://strider.gempir.com/lints/prefer-fmt-errorf/index.mdx
