mirror of
https://github.com/crazybber/awesome-patterns.git
synced 2024-12-02 01:46:02 +03:00
15 lines
230 B
Go
15 lines
230 B
Go
|
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())()
|
||
|
}
|
||
|
}
|