Skip to content

Commit ad2ca26

Browse files
doc/go1.16: mention os.DirEntry and types moved from os to io/fs
For #40700 For #41467 For #41190 Change-Id: Id94e7511c98c38a22b1f9a55af6e200c9df07fd3 Reviewed-on: https://go-review.googlesource.com/c/go/+/285592 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
1 parent a51921f commit ad2ca26

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

doc/go1.16.html

+29
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,23 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
944944
already finished.
945945
</p>
946946

947+
<p><!-- CL 261540 -->
948+
The package defines a new type
949+
<a href="/pkg/os/#DirEntry"><code>DirEntry</code></a>
950+
as an alias for <a href="/pkg/io/fs/#DirEntry"><code>fs.DirEntry</code></a>.
951+
The new <a href="/pkg/os/#ReadDir"><code>ReadDir</code></a>
952+
function and the new
953+
<a href="/pkg/os/#File.ReadDir"><code>File.ReadDir</code></a>
954+
method can be used to read the contents of a directory into a
955+
slice of <a href="/pkg/os/#DirEntry"><code>DirEntry</code></a>.
956+
The <a href="/pkg/os/#File.Readdir"><code>File.Readdir</code></a>
957+
method (note the lower case <code>d</code> in <code>dir</code>)
958+
still exists, returning a slice of
959+
<a href="/pkg/os/#FileInfo"><code>FileInfo</code></a>, but for
960+
most programs it will be more efficient to switch to
961+
<a href="/pkg/os/#File.ReadDir"><code>File.ReadDir</code></a>.
962+
</p>
963+
947964
<p><!-- CL 263141 -->
948965
The package now defines
949966
<a href="/pkg/os/#CreateTemp"><code>CreateTemp</code></a>,
@@ -953,6 +970,18 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
953970
to be used instead of functions defined in the
954971
<a href="/pkg/io/ioutil/"><code>io/ioutil</code></a> package.
955972
</p>
973+
974+
<p><!-- CL 243906 -->
975+
The types <a href="/pkg/os/#FileInfo"><code>FileInfo</code></a>,
976+
<a href="/pkg/os/#FileMode"><code>FileMode</code></a>, and
977+
<a href="/pkg/os/#PathError"><code>PathError</code></a>
978+
are now aliases for types of the same name in the
979+
<a href="/pkg/io/fs/"><code>io/fs</code></a> package.
980+
Function signatures in the <a href="/pkg/os/"><code>os</code></a>
981+
package have been updated to refer to the names in the
982+
<a href="/pkg/io/fs/"><code>io/fs</code></a> package.
983+
This should not affect any existing code.
984+
</p>
956985
</dd>
957986
</dl><!-- os -->
958987

0 commit comments

Comments
 (0)