]> Cypherpunks repositories - gostls13.git/commitdiff
doc/go1.15: mention consequence of os.File.ReadFrom
authorIan Lance Taylor <iant@golang.org>
Fri, 19 Jun 2020 05:43:36 +0000 (22:43 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 25 Jun 2020 03:11:43 +0000 (03:11 +0000)
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>
doc/go1.15.html

index b6cf5bb8f60b0c209c1e6db396f71a9477fbb363..6e98826de21a0fe087bcc5e12b0740269604cb87 100644 (file)
@@ -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>