---
title: "self-assignment"
description: "Detect assignments that store an expression back into itself."
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.

# self-assignment

**Default severity:** `warning`

Assigning a side-effect-free expression to the identical destination does
nothing and usually indicates a mistaken variable on one side. Expressions
with effectful calls or channel receives are excluded because evaluating them
can change state.

## Bad

```go
current = current
```

## Good

```go
current = next
```

Source: https://strider.gempir.com/analyzers/self-assignment/index.mdx
