// if_type_test.go
package main
import (
"fmt"
)
func main() {
var a interface{}
a = 3
// kvs := a.(map[string]interface{}) // panic
kvs , ok := a.(map[string]interface{}) // ok = false, kvs为空map
fmt.Println("kvs=", kvs, "; ok =")
}
有疑问加站长微信联系(非本文作者))
![](https://static.golangjob.cn/static/img/footer.png?imageView2/2/w/280)