awesome-patterns/playground/factory/robot.go

15 lines
230 B
Go
Raw Normal View History

2018-10-08 16:08:58 +03:00
package factory
import "log"
var speakFuncs = make(map[string]interface{})
func say(funcName string) {
speakFunc, ok := speakFuncs[funcName]
if !ok {
log.Println("speakFunc not exist")
} else {
speakFunc.(func())()
}
}