---
title: "nil-map-assignment"
description: "Detect assignments into maps proven to be nil."
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.

# nil-map-assignment

**Default severity:** `error`

Reading from a nil map is allowed, but assigning an entry to a nil map panics.
Initialize the map with `make` or a map literal before writing.

## Bad

```go
var values map[string]int; values[key] = value
```

## Good

```go
values := make(map[string]int); values[key] = value
```

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