package plugins //import "fmt" type PluginInfo struct { Name string About string Commands Command } type Command struct { Name string Callback func(args ...interface{})(string) } var Plugins []PluginInfo func (p *PluginInfo) AddPluginInfo() { Plugins = append(Plugins, *p) } func (p *PluginInfo) Handle() { } func RunPlugin(cmd string, arg string)string{ var result string for _, element := range Plugins { // fmt.Println("cmd:", key, "=>", "info:", element) // DEBUG if element.Commands.Name == cmd { result = element.Commands.Callback(arg) return result } result = "command not found" } return result }