Callable
Add function GetPublicFuncs() to make module Callable. This will allow to call you any function of your module in other parts of application or in another module.
.
.
.
func (m module) GetPublicFuncs() eather.PublicFuncList {
list := make(eather.PublicFuncList)
list["test"] = test
return list
}
func test(data ...interface{}) (interface{}, error) {
return []string{"testing public function of module"}, nil
}
.
.
.
Now it is possible to call this function from any part of application. It will print the return of test function to terminal.
if callable := eather.GetRegistry().Get("Empty").GetCallable(); callable != nil {
data, _ := callable.GetPublicFuncs().Call("test")
fmt.Println(data)
}
Last updated
Was this helpful?