编译会报错的,可以参考如下代码 func main() { var arr [4]int defer func() { e := recover() if e != nil { fmt.Println(e) } }() var i = 10 arr[i]=6 }
你这我编译都编译不过