Try this:
https://play.golang.org/p/zJa8N24nxi
--
package main
import (
"fmt"
"log"
"reflect"
)
func main() {
var controller interface{} = Test.IsWorking
funcTyp := reflect.TypeOf(controller)
structTyp := funcTyp.In(0)
newValue := reflect.New(structTyp).Interface()
fmt.Printf("%#+v", newValue)
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 c