Go——空接口与断言

断言

func main() {
	s := student{1, "wqx", 'm', 15, "hefei"}
	m := make(map[int]interface{})
	m[0] = s
	v, ok := m[0].(student) // 断言
	if ok {
		fmt.Println(v.age)
	}
}

反射

原文地址:https://www.cnblogs.com/cnloop/p/9449429.html