From fa6718d02606852897c6c91cacf0f80c4d1a0243 Mon Sep 17 00:00:00 2001 From: Ingo Gottwald Date: Tue, 1 Oct 2019 22:32:59 +0200 Subject: [PATCH] Fix grpc test vet warning (#3341) This fixes the vet warning: the cancel function returned by context.WithTimeout should be called, not discarded, to avoid a context leak. Signed-off-by: Ingo Gottwald --- test/grpc_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/grpc_test.go b/test/grpc_test.go index a0d48490d..bb49e6b9b 100644 --- a/test/grpc_test.go +++ b/test/grpc_test.go @@ -22,7 +22,8 @@ func TestGrpc(t *testing.T) { } defer g.Stop() - ctx, _ := context.WithTimeout(context.Background(), 5*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() conn, err := grpc.DialContext(ctx, tcp, grpc.WithInsecure(), grpc.WithBlock()) if err != nil { t.Fatalf("Expected no error but got: %s", err)