One thing that's missing, though: you need to handle the output of
client.Do differently when the request is cancelled (it will return an
error that you should ignore)

On Sunday, February 23, 2014, Onsi Fakhouri <onsijoe@gmail.com> wrote:

> It's closed via a defer which will clean up the goroutine
>
> On Sunday, February 23, 2014, Xiang Li <notifications@github.com<javascript:_e(%7B%7D,'cvml','notifications@github.com');>>
> wrote:
>
>> In etcd/requests.go:
>>
>> > @@ -112,8 +144,40 @@ func (c *Client) sendRequest(method string, relativePath string,
>> >  		checkRetry = DefaultCheckRetry
>> >  	}
>> >
>> > +	cancelled := false
>> > +
>> > +	if cancel != nil {
>> > +		stopCancelThread := make(chan bool)
>>
>> bad naming here. use routine instead.
>> Also, I cannot find where you actually send anything to this channel.
>>
>> --
>> Reply to this email directly or view it on GitHub<https://github.com/coreos/go-etcd/pull/108/files#r9979798>
>> .
>>
>