Skip to content

Commit c2bb350

Browse files
ianlancetaylorgopherbot
authored andcommitted
doc/go1.21: mention changes to the reflect package
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 <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Eli Bendersky <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent dcb27e8 commit c2bb350

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

doc/go1.21.html

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -652,15 +652,21 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
652652
</p>
653653

654654
<p><!-- https://go.dev/issue/55002 -->
655-
TODO: <a href="https://go.dev/issue/55002">https://go.dev/issue/55002</a>: add Value.Clear
656-
</p>
657-
658-
<p><!-- https://go.dev/issue/56906 -->
659-
TODO: <a href="https://go.dev/issue/56906">https://go.dev/issue/56906</a>: deprecate SliceHeader and StringHeader
660-
</p>
661-
662-
<p><!-- CL 452762 -->
663-
TODO: <a href="https://go.dev/cl/452762">https://go.dev/cl/452762</a>: reflect: deprecate SliceHeader and StringHeader; modified api/next/56906.txt
655+
The new <a href="/pkg/reflect/#Value"><code>Value</code></a>
656+
method <a href="/pkg/reflect/#Value.Clear"><code>Value.Clear</code></a>
657+
clears the contents of a map or zeros the contents of a slice.
658+
This corresponds to the new <code>clear</code> built-in
659+
<a href="#language">added to the language</a>.
660+
</p>
661+
662+
<p><!-- https://go.dev/issue/56906, CL 452762 -->
663+
The <a href="/pkg/reflect/#SliceHeader"><code>SliceHeader</code></a>
664+
and <a href="/pkg/reflect/#StringHeader"><code>StringHeader</code></a>
665+
types are now deprecated. In new code
666+
prefer <a href="/pkg/unsafe/#Slice"><code>unsafe.Slice</code></a>,
667+
<a href="/pkg/unsafe/#SliceData"><code>unsafe.SliceData</code></a>,
668+
<a href="/pkg/unsafe/#String"><code>unsafe.String</code></a>,
669+
or <a href="/pkg/unsafe/#StringData"><code>unsafe.StringData</code></a>.
664670
</p>
665671
</dd>
666672
</dl><!-- reflect -->

0 commit comments

Comments
 (0)