1
0
mirror of https://github.com/golang/go synced 2024-11-06 04:26:11 -07:00

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: 4ad0f3871b
GitHub-Pull-Request: golang/go#54925
Reviewed-on: https://go-review.googlesource.com/c/go/+/428977
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
This commit is contained in:
tk 2022-09-09 03:02:56 +00:00 committed by Damien Neil
parent dc98ccd836
commit e6f662d7b0

View File

@ -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)
}