問題

問題

Go的50坑:新Golang开发者要注意的陷阱、技巧和常见错误[1]

func main() {
	var a map[string]int
	a["a"] = 1 //panic: assignment to entry in nil map
	b := a["b"]
	print(b)
	if b != nil {// compile- invalid operation: v != nil (mismatched types int and untyped nil)
		print(v)
	}

}

Last updated