From: tk Date: Fri, 9 Sep 2022 03:02:56 +0000 (+0000) Subject: net/http: remove redundant code X-Git-Tag: go1.20rc1~388 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e6f662d7b071c659f4146408e31671cb32e2104c;p=gostls13.git net/http: remove redundant code Remove redundant code at line 365, `oldCtx := req.Context()`, because it's the same as line 349. Change-Id: I9b028e8c8740c22945708b143e4e86a0baa40f64 GitHub-Last-Rev: 4ad0f3871b1d473246af7cf27c158140c7248cf1 GitHub-Pull-Request: golang/go#54925 Reviewed-on: https://go-review.googlesource.com/c/go/+/428977 TryBot-Result: Gopher Robot Reviewed-by: Damien Neil Reviewed-by: Michael Knyszek Run-TryBot: Damien Neil --- diff --git a/src/net/http/client.go b/src/net/http/client.go index f57417ea10..617446b030 100644 --- a/src/net/http/client.go +++ b/src/net/http/client.go @@ -362,7 +362,7 @@ func setRequestCancel(req *Request, rt RoundTripper, deadline time.Time) (stopTi initialReqCancel := req.Cancel // the user's original Request.Cancel, if any var cancelCtx func() - if oldCtx := req.Context(); timeBeforeContextDeadline(deadline, oldCtx) { + if timeBeforeContextDeadline(deadline, oldCtx) { req.ctx, cancelCtx = context.WithDeadline(oldCtx, deadline) }