I want to call a function in a existing library from function name.
In golang, just calling method from methodname is OK, because reflect package has (v Value) MethodByName(name string). But, for calling a method, all method argument should be reflect.Value.
How can I call a function whose argument are not reflect.Value.
package main
//-------------------------------
// Example of existing library
//-------------------------------
type Client struct {
id string
}
type Method1 struct {
record string
}
// type Method2 struct{}
// ...
// defined at library : do not change
func (c *Client) Method1(d *Method1) {
d.record = c.id
}
//------------------
// Edit from here
//------------------
func main() {
// give MethodN from cmd line
method_name := "Method1"
// How can I call Method1(* Method1) propery???
// * Make Method1 instance
// * Call Method1 function
//...
//fmt.Printf("%s record is %s", method_name, d.record)
}