From dd442a556e5d9457caf318cd9b77e0a58041ab72 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Tue, 24 Jan 2012 17:02:06 -0800 Subject: [PATCH] doc/go1: mime, filepath.Walk R=golang-dev, gri, bradfitz, adg CC=golang-dev https://golang.org/cl/5571060 --- doc/go1.html | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- doc/go1.tmpl | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 98 insertions(+), 2 deletions(-) diff --git a/doc/go1.html b/doc/go1.html index b69bd6e89b8..9fe52d48a6d 100644 --- a/doc/go1.html +++ b/doc/go1.html @@ -1124,6 +1124,21 @@ and Gofix will update almost all code affected by the change.

+

The mime package

+ +

+In Go 1, the FormatMediaType function +of the mime package has been simplified to make it +consistent with +ParseMediaType. +It now takes "text/html" rather than "text" and "html". +

+ +

+Updating: +What little code is affected will be caught by the compiler and must be updated by hand. +

+

The net package

@@ -1140,7 +1155,7 @@ reads and writes will time out and no longer block.

-There is also a new net.DialTimeout method to simplify +There is also a new net.DialTimeout method to simplify timing out dialing a network address.

@@ -1224,6 +1239,39 @@ and os.FileMode API. Code that needs system-specific file details will need to be updated by hand.

+

The path/filepath package

+ +

+In Go 1, the Walk function of the +path/filepath package +has been changed to take a function value of type +WalkFunc +instead of a Visitor interface value. +WalkFunc unifies the handling of both files and directories. +

+ +
+    type WalkFunc func(path string, info *os.FileInfo, err os.Error) os.Error
+
+ +

+The WalkFunc function will be called even for files or directories that could not be opened; +in such cases the error argument will describe the failure. +If a directory's contents are to be skipped, +the function should return the value SkipDir. +

+ +

+TODO: add an example? +

+ +

+Updating: +The change simplifies most code but has subtle consequences, so affected programs +will need to be updated by hand. +The compiler will catch code using the old interface. +

+

The runtime package

diff --git a/doc/go1.tmpl b/doc/go1.tmpl index 59c78d2a40d..737507b9bbe 100644 --- a/doc/go1.tmpl +++ b/doc/go1.tmpl @@ -1027,6 +1027,21 @@ and Gofix will update almost all code affected by the change.

+

The mime package

+ +

+In Go 1, the FormatMediaType function +of the mime package has been simplified to make it +consistent with +ParseMediaType. +It now takes "text/html" rather than "text" and "html". +

+ +

+Updating: +What little code is affected will be caught by the compiler and must be updated by hand. +

+

The net package

@@ -1043,7 +1058,7 @@ reads and writes will time out and no longer block.

-There is also a new net.DialTimeout method to simplify +There is also a new net.DialTimeout method to simplify timing out dialing a network address.

@@ -1127,6 +1142,39 @@ and os.FileMode API. Code that needs system-specific file details will need to be updated by hand.

+

The path/filepath package

+ +

+In Go 1, the Walk function of the +path/filepath package +has been changed to take a function value of type +WalkFunc +instead of a Visitor interface value. +WalkFunc unifies the handling of both files and directories. +

+ +
+    type WalkFunc func(path string, info *os.FileInfo, err os.Error) os.Error
+
+ +

+The WalkFunc function will be called even for files or directories that could not be opened; +in such cases the error argument will describe the failure. +If a directory's contents are to be skipped, +the function should return the value SkipDir. +

+ +

+TODO: add an example? +

+ +

+Updating: +The change simplifies most code but has subtle consequences, so affected programs +will need to be updated by hand. +The compiler will catch code using the old interface. +

+

The runtime package