1.查看代码检查错误
package main
import "fmt"
type student struct {
Name string
Age int
}
func main() {
pase_student()
}
func pase_student() {
m := make(map[string]*student)
stus := []student{
{Name: "zhou", Age: 24},
{Name: "li", Age: 23},
{Name: "wang", Age: 22},
}
for _, stu := range stus {
m[stu.Name] = &stu
fmt.Println(m[stu.Name])
}
}
上述代码语法没有错误
2 下面输入的内容
import (
"fmt"
)
func main() {
defer_call()
}
func defer_call() {
defer func() { fmt.Println("打印前") }()
defer func() { fmt.Println("打印中") }()
defer func() { fmt.Println("打印后") }()
panic("触发异常")
}