On Mon, Dec 20, 2021 at 1:05 PM 'Ankit Gupta' via golang-nuts
<golang-nuts@googlegroups.com> wrote:
>
> If I have argument type for a function: is it possible to create a function 
> with those?
> Note:
> - we don't have reflect type for the function to be created so makeFunc can 
> not be simply used.
> - function inputTypes can differ so variadic can not be leveraged here.
> - number of inputs can differ.
>
> eg:
> input arg types: TypeA, TypeB
> expected output: func(TypeA, TypeB)
>
> -----
> Also, if it makes thing easier: Base problem which I have is:
>
> input: func(inputTypes) (outputTypes)
> expectedOutput: func(inputTypes)

Use https://pkg.go.dev/reflect#FuncOf to get the type to pass to MakeFunc.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWjHfqmMBTB40DWzwJsQsitdBDmh0dTaueL4_uSQsgcvA%40mail.gmail.com.

Reply via email to