summaryrefslogtreecommitdiff
path: root/pkg/ioutils
diff options
context:
space:
mode:
authorKir Kolyshkin <kolyshkin@gmail.com>2018-04-19 15:51:35 -0700
committerKir Kolyshkin <kolyshkin@gmail.com>2018-04-20 12:27:13 -0700
commit05e2f7e2fafd0fbc818c9f4cda7ac513c785d49c (patch)
treef5f21572af9ff15c3b607e5ecbac676d40ab5ab1 /pkg/ioutils
parente396b27b7f207f4f0da9ed66d70a69b219bbafaf (diff)
downloaddocker-05e2f7e2fafd0fbc818c9f4cda7ac513c785d49c.tar.gz
context.WithTimeout: do call the cancel func
govet complains (when using standard "context" package): > the cancel function returned by context.WithTimeout should be called, > not discarded, to avoid a context leak (vet) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Diffstat (limited to 'pkg/ioutils')
-rw-r--r--pkg/ioutils/readers_test.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/ioutils/readers_test.go b/pkg/ioutils/readers_test.go
index e009ab26f6..a32e661210 100644
--- a/pkg/ioutils/readers_test.go
+++ b/pkg/ioutils/readers_test.go
@@ -80,7 +80,8 @@ func (p *perpetualReader) Read(buf []byte) (n int, err error) {
}
func TestCancelReadCloser(t *testing.T) {
- ctx, _ := context.WithTimeout(context.Background(), 100*time.Millisecond)
+ ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
+ defer cancel()
cancelReadCloser := NewCancelReadCloser(ctx, ioutil.NopCloser(&perpetualReader{}))
for {
var buf [128]byte