From a6ecc9438efa4864cd3b11402536d0962ed9ca00 Mon Sep 17 00:00:00 2001 From: develar Date: Wed, 22 Sep 2021 13:23:33 +0200 Subject: [PATCH] =?UTF-8?q?simplify=20code=20=E2=80=94=20use=20NewRequestW?= =?UTF-8?q?ithContext=20API=20to=20create=20request?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 6 ++---- http.go | 5 +---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7971fb5..5804a55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,19 +2,17 @@ language: go go_import_path: github.com/mailgun/groupcache os: linux -dist: trusty +dist: xenial sudo: false script: - go test ./... go: - - 1.10.x - - 1.11.x - - 1.12.x - 1.13.x - 1.14.x - 1.15.x + - 1.17.x - master cache: diff --git a/http.go b/http.go index 3048afc..c7fc689 100644 --- a/http.go +++ b/http.go @@ -241,14 +241,11 @@ func (h *httpGetter) makeRequest(ctx context.Context, method string, in *pb.GetR url.QueryEscape(in.GetGroup()), url.QueryEscape(in.GetKey()), ) - req, err := http.NewRequest(method, u, nil) + req, err := http.NewRequestWithContext(ctx, method, u, nil) if err != nil { return err } - // Pass along the context to the RoundTripper - req = req.WithContext(ctx) - tr := http.DefaultTransport if h.getTransport != nil { tr = h.getTransport(ctx)