Golang reflect if initialized struct has member method or fields

12 April, 2018

In Go it is possible to check if any pointer to an initialized struct has a given method or field. The use of this is to make sure that you can call a given method, or access a given field without receiving a runtime panic.

Home