]> Cypherpunks.ru repositories - gostls13.git/commitdiff
doc/go1.21: mention changes to the reflect package
authorIan Lance Taylor <iant@golang.org>
Fri, 26 May 2023 21:25:45 +0000 (14:25 -0700)
committerGopher Robot <gobot@golang.org>
Fri, 26 May 2023 23:31:44 +0000 (23:31 +0000)
Added Value.Clear, deprecated SliceHeader and StringHeader.

For #55002
For #56906

Change-Id: Ib7497aff830d56fad90c31ec28596e71a448e9ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/498757
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

doc/go1.21.html

index b959cdb116237df2c047dc13b231c2e2fb0d33e1..88200bf33e2f227c04cd9ad75f222380ba84772c 100644 (file)
@@ -652,15 +652,21 @@ Do not send CLs removing the interior tags from such phrases.
     </p>
 
     <p><!-- https://go.dev/issue/55002 -->
-      TODO: <a href="https://go.dev/issue/55002">https://go.dev/issue/55002</a>: add Value.Clear
-    </p>
-
-    <p><!-- https://go.dev/issue/56906 -->
-      TODO: <a href="https://go.dev/issue/56906">https://go.dev/issue/56906</a>: deprecate SliceHeader and StringHeader
-    </p>
-
-    <p><!-- CL 452762 -->
-      TODO: <a href="https://go.dev/cl/452762">https://go.dev/cl/452762</a>: reflect: deprecate SliceHeader and StringHeader; modified api/next/56906.txt
+      The new <a href="/pkg/reflect/#Value"><code>Value</code></a>
+      method <a href="/pkg/reflect/#Value.Clear"><code>Value.Clear</code></a>
+      clears the contents of a map or zeros the contents of a slice.
+      This corresponds to the new <code>clear</code> built-in
+      <a href="#language">added to the language</a>.
+    </p>
+
+    <p><!-- https://go.dev/issue/56906, CL 452762 -->
+      The <a href="/pkg/reflect/#SliceHeader"><code>SliceHeader</code></a>
+      and <a href="/pkg/reflect/#StringHeader"><code>StringHeader</code></a>
+      types are now deprecated. In new code
+      prefer <a href="/pkg/unsafe/#Slice"><code>unsafe.Slice</code></a>,
+      <a href="/pkg/unsafe/#SliceData"><code>unsafe.SliceData</code></a>,
+      <a href="/pkg/unsafe/#String"><code>unsafe.String</code></a>,
+      or <a href="/pkg/unsafe/#StringData"><code>unsafe.StringData</code></a>.
     </p>
   </dd>
 </dl><!-- reflect -->