From df66daa5c92c1899d622f24573b2ca6c38ec7e20 Mon Sep 17 00:00:00 2001 From: greatroar <@> Date: Tue, 3 Mar 2020 17:53:24 +0100 Subject: [PATCH] Fix context usage in backend tests Found by go vet. This is also the only complaint is has. --- internal/backend/test/tests.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/backend/test/tests.go b/internal/backend/test/tests.go index 7e9f7f5ab..6baa44f0e 100644 --- a/internal/backend/test/tests.go +++ b/internal/backend/test/tests.go @@ -412,13 +412,11 @@ func (s *Suite) TestListCancel(t *testing.T) { }) t.Run("Timeout", func(t *testing.T) { - ctx, cancel := context.WithCancel(context.TODO()) - defer cancel() - // rather large timeout, let's try to get at least one item timeout := time.Second - ctxTimeout, _ := context.WithTimeout(ctx, timeout) + ctxTimeout, cancel := context.WithTimeout(context.TODO(), timeout) + defer cancel() i := 0 // pass in a context with a timeout