I am experiencing the same problem, and the fix from Ian will resolve it.

ymmt2005

2016年8月23日火曜日 3時08分26秒 UTC+9 Ian Lance Taylor:
>
> On Sun, Aug 21, 2016 at 9:53 AM, Manlio Perillo 
> <manlio....@gmail.com <javascript:>> wrote: 
> > I writing a simple HTTP client using the new context support in Go 1.7. 
> > I need to test it in case a timeout is specified and expires, but I'm 
> having 
> > problems. 
> > 
> > The context package defines the Cancel error variable, that is returned 
> by 
> > Context.Err when the context is canceled. 
> > However the Transport.Roundtrip method returns errRequestCanceled or 
> > errRequestCanceled, making it impossible to check if error was due to 
> > request cancelation. 
> > 
> > What about adding an `IsCanceled(err error) bool` function to the 
> context 
> > package, and redefine the errRequestCanceled and errRequestCanceled so 
> that 
> > context.IsCanceled returns true? 
> > Right now I'm checking if the error message contains the string 
> "canceled". 
>
> I think this problem is addressed in a different way by 
> https://golang.org/cl/24978.  Could you see if that change fixes your 
> problem? 
>
> 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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to