vendredi 22 octobre 2021

How to check if interface is a a pointer to a slice

I know how to check if an interface is a pointer:

func isPointerArray(i interface{}) bool {
    if i == nil {
        return false
    }
    if reflect.ValueOf(i).Kind() != reflect.Ptr {
        return false
    }
}

But how can I check if that pointer is a slice? TypeOf is a pointer.





Aucun commentaire:

Enregistrer un commentaire