From 805d6206829abfb483e2fca88c88171b777de7dc Mon Sep 17 00:00:00 2001 From: Gustavo Niemeyer Date: Wed, 25 Jan 2012 23:11:25 -0200 Subject: [PATCH] doc/go1: add net/url changes R=golang-dev, bradfitz, r CC=golang-dev https://golang.org/cl/5575056 --- doc/go1.html | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++ doc/go1.tmpl | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) diff --git a/doc/go1.html b/doc/go1.html index a895921de5..b3a000d993 100644 --- a/doc/go1.html +++ b/doc/go1.html @@ -1452,6 +1452,74 @@ Existing code is unaffected, although benchmarks that use println or panic should be updated to use the new methods.

+

The url package

+ +

+In Go 1 several fields from the url.URL type +were removed or replaced. +

+ +

+The String method now +predictably rebuilds an encoded URL string using all of URL's +fields as necessary. The resulting string will also no longer have +passwords escaped. +

+ +

+The Raw field has been removed. In most cases the String +method may be used in its place. +

+ +

+The old RawUserinfo field is replaced by the User +field, of type *net.Userinfo. +Values of this type may be created using the new net.User +and net.UserPassword +functions. The EscapeUserinfo and UnescapeUserinfo +functions are also gone. +

+ +

+The RawAuthority field has been removed. The same information is +available in the Host and User fields. +

+ +

+The RawPath field and the EncodedPath method have +been removed. The path information in rooted URLs (with a slash following the +schema) is now available only in decoded form in the Path field. +Occasionally, the encoded data may be required to obtain information that +was lost in the decoding process. These cases must be handled by accessing +the data the URL was built from. +

+ +

+URLs with non-rooted paths, such as "mailto:dev@golang.org?subject=Hi", +are also handled differently. The OpaquePath boolean field has been +removed and a new Opaque string field introduced to hold the encoded +path for such URLs. In Go 1, the cited URL parses as: +

+ +
+    URL{
+        Scheme: "mailto",
+        Opaque: "dev@golang.org",
+        RawQuery: "subject=Hi",
+    }
+
+ +

+A new RequestURI method was +added to URL. +

+ +

+Updating: +Code that uses the old fields will fail to compile and must be updated by hand. +The semantic changes make it difficult for gofix to update automatically. +

+

The go command

Packaged releases

diff --git a/doc/go1.tmpl b/doc/go1.tmpl index 56629c6df6..4e59354bcc 100644 --- a/doc/go1.tmpl +++ b/doc/go1.tmpl @@ -1342,6 +1342,74 @@ Existing code is unaffected, although benchmarks that use println or panic should be updated to use the new methods.

+

The url package

+ +

+In Go 1 several fields from the url.URL type +were removed or replaced. +

+ +

+The String method now +predictably rebuilds an encoded URL string using all of URL's +fields as necessary. The resulting string will also no longer have +passwords escaped. +

+ +

+The Raw field has been removed. In most cases the String +method may be used in its place. +

+ +

+The old RawUserinfo field is replaced by the User +field, of type *net.Userinfo. +Values of this type may be created using the new net.User +and net.UserPassword +functions. The EscapeUserinfo and UnescapeUserinfo +functions are also gone. +

+ +

+The RawAuthority field has been removed. The same information is +available in the Host and User fields. +

+ +

+The RawPath field and the EncodedPath method have +been removed. The path information in rooted URLs (with a slash following the +schema) is now available only in decoded form in the Path field. +Occasionally, the encoded data may be required to obtain information that +was lost in the decoding process. These cases must be handled by accessing +the data the URL was built from. +

+ +

+URLs with non-rooted paths, such as "mailto:dev@golang.org?subject=Hi", +are also handled differently. The OpaquePath boolean field has been +removed and a new Opaque string field introduced to hold the encoded +path for such URLs. In Go 1, the cited URL parses as: +

+ +
+    URL{
+        Scheme: "mailto",
+        Opaque: "dev@golang.org",
+        RawQuery: "subject=Hi",
+    }
+
+ +

+A new RequestURI method was +added to URL. +

+ +

+Updating: +Code that uses the old fields will fail to compile and must be updated by hand. +The semantic changes make it difficult for gofix to update automatically. +

+

The go command

Packaged releases

-- 2.48.1