mirror of
https://github.com/golang/go
synced 2024-11-11 20:01:37 -07:00
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>
This commit is contained in:
parent
a51921fa5b
commit
ad2ca26a52
@ -944,6 +944,23 @@ func TestFoo(t *testing.T) {
|
||||
already finished.
|
||||
</p>
|
||||
|
||||
<p><!-- CL 261540 -->
|
||||
The package defines a new type
|
||||
<a href="/pkg/os/#DirEntry"><code>DirEntry</code></a>
|
||||
as an alias for <a href="/pkg/io/fs/#DirEntry"><code>fs.DirEntry</code></a>.
|
||||
The new <a href="/pkg/os/#ReadDir"><code>ReadDir</code></a>
|
||||
function and the new
|
||||
<a href="/pkg/os/#File.ReadDir"><code>File.ReadDir</code></a>
|
||||
method can be used to read the contents of a directory into a
|
||||
slice of <a href="/pkg/os/#DirEntry"><code>DirEntry</code></a>.
|
||||
The <a href="/pkg/os/#File.Readdir"><code>File.Readdir</code></a>
|
||||
method (note the lower case <code>d</code> in <code>dir</code>)
|
||||
still exists, returning a slice of
|
||||
<a href="/pkg/os/#FileInfo"><code>FileInfo</code></a>, but for
|
||||
most programs it will be more efficient to switch to
|
||||
<a href="/pkg/os/#File.ReadDir"><code>File.ReadDir</code></a>.
|
||||
</p>
|
||||
|
||||
<p><!-- CL 263141 -->
|
||||
The package now defines
|
||||
<a href="/pkg/os/#CreateTemp"><code>CreateTemp</code></a>,
|
||||
@ -953,6 +970,18 @@ func TestFoo(t *testing.T) {
|
||||
to be used instead of functions defined in the
|
||||
<a href="/pkg/io/ioutil/"><code>io/ioutil</code></a> package.
|
||||
</p>
|
||||
|
||||
<p><!-- CL 243906 -->
|
||||
The types <a href="/pkg/os/#FileInfo"><code>FileInfo</code></a>,
|
||||
<a href="/pkg/os/#FileMode"><code>FileMode</code></a>, and
|
||||
<a href="/pkg/os/#PathError"><code>PathError</code></a>
|
||||
are now aliases for types of the same name in the
|
||||
<a href="/pkg/io/fs/"><code>io/fs</code></a> package.
|
||||
Function signatures in the <a href="/pkg/os/"><code>os</code></a>
|
||||
package have been updated to refer to the names in the
|
||||
<a href="/pkg/io/fs/"><code>io/fs</code></a> package.
|
||||
This should not affect any existing code.
|
||||
</p>
|
||||
</dd>
|
||||
</dl><!-- os -->
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user