aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/request.go
diff options
context:
space:
mode:
authorDmitri Shuralyov <dmitshur@golang.org>2019-10-21 15:30:13 -0400
committerDmitri Shuralyov <dmitshur@golang.org>2019-10-21 20:43:40 +0000
commit3409ce39bfd7584523b7a8c150a310cea92d879d (patch)
tree3bb6782d0e73f973a35ffb665994f70d0d17d3db /src/net/http/request.go
parentd24cf6d53e854d0f7cda6912575c7054637ed53c (diff)
downloadgo-3409ce39bfd7584523b7a8c150a310cea92d879d.tar.xz
net/http: remove parseURL variable
The parseURL variable was introduced in CL 49930 in order to work around the fact that the name "url" was shadowed by a parameter of exported functions, and couldn't be renamed without sacrificing documentation readability. Documentation readability takes higher priority than internal implementation details. Back then, I considered renaming the net/url import but saw that it would be too disruptive of a change to the large net/http package. Now I see a better way: it's possible to import net/url both as url and as urlpkg (the package is still imported just once, but it becomes available via two names). This way we eliminate the need for wasting (a little) memory on the parseURL variable, improve code readability slightly, and delete some lines of code and comments. Updates #21077 Change-Id: I42cd9833afdcf4a5f5874fb7ee9c8c11eae557dc Reviewed-on: https://go-review.googlesource.com/c/go/+/202482 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/net/http/request.go')
-rw-r--r--src/net/http/request.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/net/http/request.go b/src/net/http/request.go
index 1fdd8a4fc7..72261a1bd5 100644
--- a/src/net/http/request.go
+++ b/src/net/http/request.go
@@ -22,6 +22,7 @@ import (
"net/http/httptrace"
"net/textproto"
"net/url"
+ urlpkg "net/url"
"strconv"
"strings"
"sync"
@@ -850,7 +851,7 @@ func NewRequestWithContext(ctx context.Context, method, url string, body io.Read
if ctx == nil {
return nil, errors.New("net/http: nil Context")
}
- u, err := parseURL(url) // Just url.Parse (url is shadowed for godoc).
+ u, err := urlpkg.Parse(url)
if err != nil {
return nil, err
}