Skip to content

Instantly share code, notes, and snippets.

@tkrajina
Created March 2, 2016 08:09
Show Gist options
  • Save tkrajina/3b26db11a8d4084289b0 to your computer and use it in GitHub Desktop.
Save tkrajina/3b26db11a8d4084289b0 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"reflect"
)
type Test struct {
}
func (t Test) Something(aaa string) {
fmt.Println("aaa=", aaa)
}
func main() {
t := Test{}
method2 := reflect.ValueOf(&t).MethodByName("Something")
fmt.Println("method=", method2)
method2.Call([]reflect.Value{reflect.ValueOf("jkljkl")})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment