aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAgniva De Sarker <agnivade@yahoo.co.in>2019-05-22 00:10:32 +0200
committerBrad Fitzpatrick <bradfitz@golang.org>2019-05-22 17:22:46 +0000
commita326bc6df27309815e4a2ae005adef233cfb9ea9 (patch)
tree9590e6466cce395449d3b00c323d8fcee4903830 /src
parent42bb47689310ebe2fedd165db98402a7874dc6be (diff)
downloadgo-a326bc6df27309815e4a2ae005adef233cfb9ea9.tar.xz
net/url: clarify that RawPath is optionally set
Fixes #29662 Change-Id: I38b52b96712e44a323333da17dbbc883516773b6 Reviewed-on: https://go-review.googlesource.com/c/go/+/177900 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/net/url/url.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/net/url/url.go b/src/net/url/url.go
index 9ff707b24e..7f6ff93ce4 100644
--- a/src/net/url/url.go
+++ b/src/net/url/url.go
@@ -337,10 +337,11 @@ func escape(s string, mode encoding) string {
// Note that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.
// A consequence is that it is impossible to tell which slashes in the Path were
// slashes in the raw URL and which were %2f. This distinction is rarely important,
-// but when it is, code must not use Path directly.
-// The Parse function sets both Path and RawPath in the URL it returns,
-// and URL's String method uses RawPath if it is a valid encoding of Path,
-// by calling the EscapedPath method.
+// but when it is, the code should use RawPath, an optional field which only gets
+// set if the default encoding is different from Path.
+//
+// URL's String method uses the EscapedPath method to obtain the path. See the
+// EscapedPath method for more details.
type URL struct {
Scheme string
Opaque string // encoded opaque data