Aaron
Aaron

Reputation: 461

How can I define a function type adapted to any function in golang

I just want to define a function type which will match all functions and I have tried this:

type funcType func(...interface{}) ...interface{} but failed

How can I do this?

Upvotes: 4

Views: 3959

Answers (1)

Paul Hankin
Paul Hankin

Reputation: 58409

There is no function type that's compatible with any function.

The best you can do is interface{} to which any value is assignable to, including functions.

Upvotes: 5

Related Questions