I was learning about pointers in Go. And managed to write something like:
func hello(){
fmt.Println(\"Hello World\")
}
func main(){
pfunc := hel
A different way to approach it is to define an interface
type command interface {
DoLoop()
}
implement a struct that implements it
type Delete struct {
instance string
}
func (dev Delete) DoLoop() {
fmt.Println("input: delete ")
}
Create map that contains the struct
mainFuncTable = make(map[string]command)
mainFuncTable["delete"] = Delete{"new"}
the call the function
func route(command string) {
cmd := mainFuncTable[command]
cmd.DoLoop()
}
It's a little indirect but it works