mirror of
https://github.com/golang/go
synced 2024-11-23 05:40:04 -07:00
doc/go1.15: mention consequence of os.File.ReadFrom
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>
This commit is contained in:
parent
d7e3a161f5
commit
1bb247a469
@ -782,6 +782,20 @@ Do not send CLs removing the interior tags from such phrases.
|
||||
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>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user