Skip to content

Commit

Permalink
doc/go1.15: mention consequence of os.File.ReadFrom
Browse files Browse the repository at this point in the history
Now that we've added a os.File.ReadFrom method, io.CopyBuffer to a
os.File will no longer use the provided buffer.

For #16474
For #36817
For #37419

Change-Id: I79a3bf778ff93eab88e88dd9ecbb8c7ea101e868
Reviewed-on: https://go-review.googlesource.com/c/go/+/238864
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
  • Loading branch information
ianlancetaylor committed Jun 25, 2020
1 parent d7e3a16 commit 1bb247a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions doc/go1.15.html
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,20 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
1.14 with the addition of asynchronous preemption. Now this is
handled transparently.
</p>

<p><!-- CL 229101 -->
The <a href="/pkg/os/#File"><code>os.File</code></a> type now
supports a <a href="/pkg/os/#File.ReadFrom"><code>ReadFrom</code></a>
method. This permits the use of the <code>copy_file_range</code>
system call on some systems when using
<a href="/pkg/io/#Copy"><code>io.Copy</code></a> to copy data
from one <code>os.File</code> to another. A consequence is that
<a href="/pkg/io/#CopyBuffer"><code>io.CopyBuffer</code></a>
will not always use the provided buffer when copying to a
<code>os.File</code>. If a program wants to force the use of
the provided buffer, it can be done by writing
<code>io.CopyBuffer(struct{ io.Writer }{dst}, src, buf)</code>.
</p>
</dd>
</dl>

Expand Down

0 comments on commit 1bb247a

Please sign in to comment.