dimanche 20 janvier 2019

Golang: Access un-exported variable from package

Does Go allow the use of reflection (or any other method) to extract un-exported variables from a package. For instance, let's say we have a package that includes the following variable:

// ... various exported functions

var _MySecretVariable = MySecretStruct{ /* ... */ }

Is there any way to access _MyDescretVariable. The name of the variable is known.





Aucun commentaire:

Enregistrer un commentaire