go语言中的映射是将键映射到值。
1 | func TestStringMap(t *testing.T) { |
如果不调用make,那么在调用m["john"] = "wonder"
的时候就会报如下错:
panic: assignment to entry in nil map [recovered]
panic: assignment to entry in nil map
1 | func TestStringMap(t *testing.T) { |
如果不调用make,那么在调用m["john"] = "wonder"
的时候就会报如下错:
panic: assignment to entry in nil map [recovered]
panic: assignment to entry in nil map