func main() {
var data interface{} = "ehoo"
if res, ok := data.(int); ok {
fmt.Printf("int res:%d\n", res)
} else if res, ok := data.(bool); ok {
fmt.Printf("bool res:%b\n", res)
} else {
fmt.Printf("other res:%v\n", res) // 断言类型的零值,结果:false
}
}