Main question is "is it possible to pass any type func as param and how?". I am learning Go and want to make my own async wrap function like this:
func AsyncFunc(fn func(), args ...interface{}) chan bool {
var done chan bool;
go func() {
fn(args...);
done <- true;
}();
return done;
}
and call it:
max := func(a, b int) int {
//some hard code what will be goroutine
if a > b {return a};
return b;
}
done := AsyncFunc(max, 5, 8);
//some pretty code
<- done;
P.S. sorry for my English if it is bad...
Edit1: I know it is useless, slow and danger. It is just my crazy idea what i want just realise.