Skip to content

Instantly share code, notes, and snippets.

View kcmerrill's full-sized avatar

kc merrill kcmerrill

View GitHub Profile
@kcmerrill
kcmerrill / invoke()
Last active November 23, 2017 20:50
func (a *Alfred) invoke(method string, args ...interface{}) chan bool {
finished := make(chan bool)
params := make([]reflect.Value, len(args))
for idx := range args {
params[idx] = reflect.ValueOf(args[idx])
}
reflect.ValueOf(a).MethodByName(strings.Title(strings.ToLower(method))).Call(params)
return finished
}