Skip to content

Commit e6b6d10

Browse files
doc/go1.16: mention deprecation of io/ioutil
For #40025 For #40700 For #42026 Change-Id: Ib51b5e1398c4eb811506df21e3bd56dd84bd1f7e Reviewed-on: https://go-review.googlesource.com/c/go/+/285377 Trust: Ian Lance Taylor <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 96a2763 commit e6b6d10

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

doc/go1.16.html

+57
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,44 @@ <h3 id="fs">File Systems</h3>
499499
implementations.
500500
</p>
501501

502+
<h3 id="ioutil">Deprecation of io/ioutil</h3>
503+
504+
<p>
505+
The <a href="/pkg/io/ioutil/"><code>io/ioutil</code></a> package has
506+
turned out to be a poorly defined and hard to understand collection
507+
of things. All functionality provided by the package has been moved
508+
to other packages. The <code>io/ioutil</code> package remains and
509+
will continue to work as before, but we encourage new code to use
510+
the new definitions in the <a href="/pkg/io/"><code>io</code></a> and
511+
<a href="/pkg/os/"><code>os</code></a> packages.
512+
513+
Here is a list of the new locations of the names exported
514+
by <code>io/ioutil</code>:
515+
<ul>
516+
<li><a href="/pkg/io/ioutil/#Discard"><code>Discard</code></a>
517+
=> <a href="/pkg/io/#Discard"><code>io.Discard</code></a></li>
518+
<li><a href="/pkg/io/ioutil/#NopCloser"><code>NopCloser</code></a>
519+
=> <a href="/pkg/io/#NopCloser"><code>io.NopCloser</code></a></li>
520+
<li><a href="/pkg/io/ioutil/#ReadAll"><code>ReadAll</code></a>
521+
=> <a href="/pkg/io/#ReadAll"><code>io.ReadAll</code></a></li>
522+
<li><a href="/pkg/io/ioutil/#ReadDir"><code>ReadDir</code></a>
523+
=> <a href="/pkg/os/#ReadDir"><code>os.ReadDir</code></a>
524+
(note: returns a slice of
525+
<a href="/pkg/os/#DirEntry"><code>os.DirEntry</code></a>
526+
rather than a slice of
527+
<a href="/pkg/fs/#FileInfo"><code>fs.FileInfo</code></a>)
528+
</li>
529+
<li><a href="/pkg/io/ioutil/#ReadFile"><code>ReadFile</code></a>
530+
=> <a href="/pkg/os/#ReadFile"><code>os.ReadFile</code></a></li>
531+
<li><a href="/pkg/io/ioutil/#TempDir"><code>TempDir</code></a>
532+
=> <a href="/pkg/os/#MkdirTemp"><code>os.MkdirTemp</code></a></li>
533+
<li><a href="/pkg/io/ioutil/#TempFile"><code>TempFile</code></a>
534+
=> <a href="/pkg/os/#CreateTemp"><code>os.CreateTemp</code></a></li>
535+
<li><a href="/pkg/io/ioutil/#WriteFile"><code>WriteFile</code></a>
536+
=> <a href="/pkg/os/#WriteFile"><code>os.WriteFile</code></a></li>
537+
</ul>
538+
</p>
539+
502540
<!-- okay-after-beta1
503541
TODO: decide if any additional changes are worth factoring out from
504542
"Minor changes to the library" and highlighting in "Core library"
@@ -742,6 +780,15 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
742780
The package now defines a
743781
<a href="/pkg/io/#ReadSeekCloser"><code>ReadSeekCloser</code></a> interface.
744782
</p>
783+
784+
<p><!-- CL 263141 -->
785+
The package now defines
786+
<a href="/pkg/io/#Discard"><code>Discard</code></a>,
787+
<a href="/pkg/io/#NopCloser"><code>NopCloser</code></a>, and
788+
<a href="/pkg/io/#ReadAll"><code>ReadAll</code></a>,
789+
to be used instead of the same names in the
790+
<a href="/pkg/io/ioutil/"><code>io/ioutil</code></a> package.
791+
</p>
745792
</dd>
746793
</dl><!-- io -->
747794

@@ -896,6 +943,16 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
896943
instead of the unexported <code>errFinished</code> when the process has
897944
already finished.
898945
</p>
946+
947+
<p><!-- CL 263141 -->
948+
The package now defines
949+
<a href="/pkg/os/#CreateTemp"><code>CreateTemp</code></a>,
950+
<a href="/pkg/os/#MkdirTemp"><code>MkdirTemp</code></a>,
951+
<a href="/pkg/os/#ReadFile"><code>ReadFile</code></a>, and
952+
<a href="/pkg/os/#WriteFile"><code>WriteFile</code></a>,
953+
to be used instead of functions defined in the
954+
<a href="/pkg/io/ioutil/"><code>io/ioutil</code></a> package.
955+
</p>
899956
</dd>
900957
</dl><!-- os -->
901958

0 commit comments

Comments
 (0)