Skip to content

Commit 33d8cde

Browse files
rscgopherbot
authored andcommitted
reflect: deprecate SliceHeader and StringHeader
These are replaced by unsafe.String etc, which were added in Go 1.20. Per https://go.dev/wiki/Deprecated, we must wait until Go 1.21 to mark them deprecated. Fixes #56906. Change-Id: I4198c3f3456e9e2031f6c7232842e187e6448892 Reviewed-on: https://go-review.googlesource.com/c/go/+/452762 TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Russ Cox <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Emmanuel Odeke <[email protected]> Run-TryBot: Russ Cox <[email protected]>
1 parent 45eded3 commit 33d8cde

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

api/next/56906.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pkg reflect, type SliceHeader //deprecated #56906
2+
pkg reflect, type StringHeader //deprecated #56906

src/reflect/value.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -2743,7 +2743,7 @@ func (v Value) UnsafePointer() unsafe.Pointer {
27432743
// it references will not be garbage collected, so programs must keep
27442744
// a separate, correctly typed pointer to the underlying data.
27452745
//
2746-
// In new code, use unsafe.String or unsafe.StringData instead.
2746+
// Deprecated: Use unsafe.String or unsafe.StringData instead.
27472747
type StringHeader struct {
27482748
Data uintptr
27492749
Len int
@@ -2756,7 +2756,7 @@ type StringHeader struct {
27562756
// it references will not be garbage collected, so programs must keep
27572757
// a separate, correctly typed pointer to the underlying data.
27582758
//
2759-
// In new code, use unsafe.Slice or unsafe.SliceData instead.
2759+
// Deprecated: Use unsafe.Slice or unsafe.SliceData instead.
27602760
type SliceHeader struct {
27612761
Data uintptr
27622762
Len int

0 commit comments

Comments
 (0)