mardi 11 avril 2017

Get a value of an interface using reflect

I'm trying to get a value from an interface (it should be a pointer to another struct see). Actually, I have to know the type of the pointer to access to the data it and it bother me. That's why I would like to use reflect package to do it better.

Actually, I can display the type using reflect.TypeOf(event.Event).String() but I don't understand how to change this line in the example without specifying with something like .(*marathon.EventDeploymentStepSuccess) and using reflect.





Aucun commentaire:

Enregistrer un commentaire