lundi 15 octobre 2018

can I get whether a field has been assigned with reflection in golang

I have a struct as below:

type Demo struct{
     A string
     B string
}

and I have a instance of it as below:

demo := Demo{A:"a"}

the field of A has been assigned value but field B not. Now, I want to know are there exist some method that I can get the field of Instance A which has been assigned value through reflection?

Here I want to get field A.





Aucun commentaire:

Enregistrer un commentaire