What I am doing
func foo(a string) {}
func bar(b, c string)
type fn func(string)
m: = map[string] fn {
"a": "foo",
"b": "bar"
}
What is output
when I call function like this
m["a"]("Hello")
m["b"]("Hello", "World")
I got an error because type fn func(string)
here fn have single parameter but I pass double parameter in m["b"]("Hello", "World")
Error : [ cannot use (type func(string, string)) as type fn in map value ]
What I am looking for
I want to make dynamic type fn func(string)
so that I can pass number of parameter so that I can call like this
m["a"]("Hello")
m["b"]("Hello", "World")