Which fix removes the bug?
var counts map[string]int counts["go"] = 1
- Create it with
make(map[string]int) - Use
counts.Set("go", 1)instead - Write the key as a rune:
'g' - Change the map's value type to
int64
A nil map can be read but not written; assigning to it panics until the map is created with make.
Play Problem Solving ▸