mercredi 27 avril 2016

In golang, is there a way to check whether value is pointer field?

I have a slice of interface{} and i need to check whether this slice contains pointer field values.

clarification example:

var str *string
s := "foo"
str = &s
var parms = []interface{}{"a",1233,"b",str}
index := getPointerIndex(parms)
fmt.Println(index)// will print 3





Aucun commentaire:

Enregistrer un commentaire