Skip to content

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.

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