From e86e2718db89775a4604abc10a5d3a5672e7336e Mon Sep 17 00:00:00 2001 From: Jeff Craig Date: Wed, 4 May 2016 16:09:14 -0500 Subject: [PATCH] internal: fix transport_test use of nil Context The context library recommends never using a nil Context, and context.Background() provides an empty Context appropriate for use in unit tests. Change-Id: I2656f846ea1f892ad41ad63a92ecb789a46e3453 Reviewed-on: https://go-review.googlesource.com/22791 Reviewed-by: Brad Fitzpatrick --- internal/transport_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/transport_test.go b/internal/transport_test.go index 313f637..8772ec5 100644 --- a/internal/transport_test.go +++ b/internal/transport_test.go @@ -18,7 +18,7 @@ func TestContextClient(t *testing.T) { }) c := &http.Client{} - ctx := context.WithValue(nil, HTTPClient, c) + ctx := context.WithValue(context.Background(), HTTPClient, c) hc, err := ContextClient(ctx) if err != nil {