Lets say an example function like this
func (r *Router) Get(path string, controller interface{}) {}
And I am calling it this way
Route.Get("/", controllers.Test.IsWorking)
Refering to this function
type Test struct {
Name string
}
func (t Test) IsWorking() {
log.Println("hello")
}
How can I get what struct is the function using? I mean on this example the struct would be Test and the function IsWorking... I have no idea how to achieve this
Running a reflect TypeOf to controller returns this
But I am not sure how to create a reflect.New of the type of controller.Test (without knowing about it)