Skip to content

Commit e86e271

Browse files
foxxtrotbradfitz
authored andcommitted
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 <[email protected]>
1 parent 8434495 commit e86e271

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/transport_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestContextClient(t *testing.T) {
1818
})
1919

2020
c := &http.Client{}
21-
ctx := context.WithValue(nil, HTTPClient, c)
21+
ctx := context.WithValue(context.Background(), HTTPClient, c)
2222

2323
hc, err := ContextClient(ctx)
2424
if err != nil {

0 commit comments

Comments
 (0)