On Wed, Sep 12, 2018 at 2:23 PM robert engels <reng...@ix.netcom.com> wrote:

> I am pretty sure that is not correct, I am referring to:
>
> func WithContext(context Context, f func() error) error {
> context.__entry__()
> defer context.__exit__()
> return f()
> }
>
>
> You will need a lot of WithContext methods - based on the different
> signatures of function f.
>
> See the main method… I am assuming this is attempting to be a general
> facility - and thus the signature of f will vary.
>

you just need to wrap it with a closure, just as Eric did:

e.g.:
 func QueryDB(a,b int) error { ... }

 WithContext(ctx, func() error {
    return QueryDB(42, 666)
 })

and voila.

-s

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to