Thank you Silviu, that seems to work.

Do you know exactly why it flakes? what is racing? just for me to have an 
understanding of why this happens

On Sunday, 17 September 2017 01:19:35 UTC+1, Silviu Capota Mera wrote:
>
> Hi Steven,
>
> In case it's still unclear, you need to wrap both the "do request" + "read 
> body" inside the same cancellation context. The "defer cancel" should 
> encompass both of them, sort of atomically, so the idea is to take it out 
> of your fetch, one level up.
>
> https://play.golang.org/p/trMP7Q-maT
>
> Cheers,
> silviu
>
> On Saturday, 16 September 2017 16:16:05 UTC-4, Steven Lee wrote:
>>
>> I guess thats plausible
>>
>> Ive tried to find the code in the library that sets the body if a context 
>> is cancelled but cant, I understand how to fix the code just struggling to 
>> understand the mechanics and especially why it flakes :(
>>
>

-- 
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