Skip to content

Instantly share code, notes, and snippets.

@kcmerrill
Last active November 23, 2017 20:50
Show Gist options
  • Save kcmerrill/8d6bb14c46f17c26c4daf9d3c5825ca5 to your computer and use it in GitHub Desktop.
Save kcmerrill/8d6bb14c46f17c26c4daf9d3c5825ca5 to your computer and use it in GitHub Desktop.
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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment