t := i.(T)
例如:
func main() {
var i interface{} = "hello"
s := i.(string)
fmt.Println(s)
s, ok := i.(string)
fmt.Println(s, ok)
f, ok := i.(float64)
fmt.Println(f, ok)
f = i.(float64) // panic
fmt.Println(f)
}
// 输出:
hello
hello true
0 false
panic: interface conversion: interface {} is string, not float64