(expanding the code from the link) _, err := http.DefaultClient.Do(r) log.Println(err, ctx.Err() == context.Canceled)
Note that, to be pedantic, this only tells you that the context has been cancelled - not that that was the error returned by the HTTP request. The HTTP request may have succeeded, or failed for another reason, before the context was cancelled. Whether this matters is of course up to the application. //jb On 8 Nov 2017, at 13:19, Jan Mercl <[email protected]<mailto:[email protected]>> wrote: On Wed, Nov 8, 2017 at 1:12 PM Glen Huang <[email protected]<mailto:[email protected]>> wrote: see https://play.golang.org/p/wMJ5PX1x9H -- -j -- 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 [email protected]<mailto:[email protected]>. For more options, visit https://groups.google.com/d/optout. -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
