]> Cypherpunks repositories - gostls13.git/commitdiff
doc/go1: mime, filepath.Walk
authorRob Pike <r@golang.org>
Wed, 25 Jan 2012 01:02:06 +0000 (17:02 -0800)
committerRob Pike <r@golang.org>
Wed, 25 Jan 2012 01:02:06 +0000 (17:02 -0800)
R=golang-dev, gri, bradfitz, adg
CC=golang-dev
https://golang.org/cl/5571060

doc/go1.html
doc/go1.tmpl

index b69bd6e89b8c416278e210722760c8b591fb6859..9fe52d48a6d6ddadea822a232f869beaf7596e80 100644 (file)
@@ -1124,6 +1124,21 @@ and
 Gofix will update almost all code affected by the change.
 </p>
 
+<h3 id="mime">The mime package</h3>
+
+<p>
+In Go 1, the <a href="/pkg/mime/#FormatMediaType"><code>FormatMediaType</code></a> function
+of the <code>mime</code> package has  been simplified to make it
+consistent with
+<a href="/pkg/mime/#ParseMediaType"><code>ParseMediaType</code></a>. 
+It now takes <code>"text/html"</code> rather than <code>"text"</code> and <code>"html"</code>.
+</p>
+
+<p>
+<em>Updating</em>:
+What little code is affected will be caught by the compiler and must be updated by hand.
+</p>
+
 <h3 id="net">The net package</h3>
 
 <p>
@@ -1140,7 +1155,7 @@ reads and writes will time out and no longer block.
 </p>
 
 <p>
-There is also a new <a href="/pkg/net/#DialTimeout">net.DialTimeout</code></a> method to simplify
+There is also a new <a href="/pkg/net/#DialTimeout"><code>net.DialTimeout</code></a> method to simplify
 timing out dialing a network address.
 </p>
 
@@ -1224,6 +1239,39 @@ and <code>os.FileMode</code> API.
 Code that needs system-specific file details will need to be updated by hand.
 </p>
 
+<h3 id="path_filepath">The path/filepath package</h3>
+
+<p>
+In Go 1, the <a href="/pkg/path/filepath/#Walk"><code>Walk</code></a> function of the
+<code>path/filepath</code> package
+has been changed to take a function value of type
+<a href="/pkg/path/filepath/#WalkFunc"><code>WalkFunc</code></a>
+instead of a <code>Visitor</code> interface value.
+<code>WalkFunc</code> unifies the handling of both files and directories.
+</p>
+
+<pre>
+    type WalkFunc func(path string, info *os.FileInfo, err os.Error) os.Error
+</pre>
+
+<p>
+The <code>WalkFunc</code> 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 <code>SkipDir</code>.
+</p>
+
+<p>
+<font color="red">TODO: add an example?</font>
+</p>
+
+<p>
+<em>Updating</em>:
+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.
+</p>
+
 <h3 id="runtime">The runtime package</h3>
 
 <p>
index 59c78d2a40de3f725a33a97e36e0d559da488637..737507b9bbee57f922e07405281264717f12db40 100644 (file)
@@ -1027,6 +1027,21 @@ and
 Gofix will update almost all code affected by the change.
 </p>
 
+<h3 id="mime">The mime package</h3>
+
+<p>
+In Go 1, the <a href="/pkg/mime/#FormatMediaType"><code>FormatMediaType</code></a> function
+of the <code>mime</code> package has  been simplified to make it
+consistent with
+<a href="/pkg/mime/#ParseMediaType"><code>ParseMediaType</code></a>. 
+It now takes <code>"text/html"</code> rather than <code>"text"</code> and <code>"html"</code>.
+</p>
+
+<p>
+<em>Updating</em>:
+What little code is affected will be caught by the compiler and must be updated by hand.
+</p>
+
 <h3 id="net">The net package</h3>
 
 <p>
@@ -1043,7 +1058,7 @@ reads and writes will time out and no longer block.
 </p>
 
 <p>
-There is also a new <a href="/pkg/net/#DialTimeout">net.DialTimeout</code></a> method to simplify
+There is also a new <a href="/pkg/net/#DialTimeout"><code>net.DialTimeout</code></a> method to simplify
 timing out dialing a network address.
 </p>
 
@@ -1127,6 +1142,39 @@ and <code>os.FileMode</code> API.
 Code that needs system-specific file details will need to be updated by hand.
 </p>
 
+<h3 id="path_filepath">The path/filepath package</h3>
+
+<p>
+In Go 1, the <a href="/pkg/path/filepath/#Walk"><code>Walk</code></a> function of the
+<code>path/filepath</code> package
+has been changed to take a function value of type
+<a href="/pkg/path/filepath/#WalkFunc"><code>WalkFunc</code></a>
+instead of a <code>Visitor</code> interface value.
+<code>WalkFunc</code> unifies the handling of both files and directories.
+</p>
+
+<pre>
+    type WalkFunc func(path string, info *os.FileInfo, err os.Error) os.Error
+</pre>
+
+<p>
+The <code>WalkFunc</code> 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 <code>SkipDir</code>.
+</p>
+
+<p>
+<font color="red">TODO: add an example?</font>
+</p>
+
+<p>
+<em>Updating</em>:
+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.
+</p>
+
 <h3 id="runtime">The runtime package</h3>
 
 <p>