vendredi 27 janvier 2017

How to get the string representation of a type?

Let's say I have the following type defined:

type ID uuid.UUID

How would I get the type as string in a programmatic way so it's easy to refactor later other than maybe:

fmt.Sprintf("%T", ID{})

which I don't quite like because it instantiates it, also from an Interface.





Aucun commentaire:

Enregistrer un commentaire