Is it possible to obtain a variable name at runtime?

If the field is part of a struct, you can recover the name via reflection. fmt’s %#v verb is useful here.

1 Like