mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00

We make v2 client code a module go.etcd.io/etcd/client/v2. Pretty mechanical change that can be summarized as: mkdir client/v2 cd client/v2 && git mod init go.etcd.io/etcd/client/v2 git mv client/*.go client/v2/ find -name '*.go' | xargs sed -i --follow-symlinks 's|/v3/client["]|/client/v2\"|g' + fixing changelog, bom, go.mod etc.
19 lines
405 B
Go
19 lines
405 B
Go
// Copyright 2015 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// borrowed from golang/net/context/ctxhttp/cancelreq.go
|
|
|
|
package client
|
|
|
|
import "net/http"
|
|
|
|
func requestCanceler(tr CancelableTransport, req *http.Request) func() {
|
|
ch := make(chan struct{})
|
|
req.Cancel = ch
|
|
|
|
return func() {
|
|
close(ch)
|
|
}
|
|
}
|