mercredi 5 janvier 2022

empty interface'kind in go is invalid kind? [duplicate]

I want know the kind of empty interface,and test code is below,from the source code of go I find that there is a kind called Interface,but the output shows that interface{}'kind is invalid.

Why the interface{}'s kind is invalid and how can I get a Interface kind?

func main() {
        var i interface{}
        fmt.Println("kind:", reflect.ValueOf(i).Kind())
}

output: kind: invalid





Aucun commentaire:

Enregistrer un commentaire