aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlo Alberto Ferraris <cafxx@strayorange.com>2022-04-21 17:49:12 +0900
committerGopher Robot <gobot@golang.org>2022-05-18 15:15:29 +0000
commitbc2e961cf4cda945dc6d607a5076b4e376553e9f (patch)
treef57f4b4c3ec67188d2ff72e030db375949b176c1 /src
parent5f2fdbe7ed58bc98b60521bde2f3fcdc4af20826 (diff)
downloadgo-bc2e961cf4cda945dc6d607a5076b4e376553e9f.tar.xz
reflect: deprecate (Slice|String)Header
As discussed in CL 401434 there are substantial misuses of these in the wild, and they are a potential source of unsafety even for code that does not use them directly. We should either keep them as-is and document when/how they can be used safely, or deprecate them so that uses will eventually die out. After some discussion, it was decided to deprecate them outright. Since the docs already mentioned that they may be unstable across releases, it should be possible to get rid of them completely later on. Change-Id: I3b75819409177b5a286c1e9861a2edb6fd1301b8 Reviewed-on: https://go-review.googlesource.com/c/go/+/401434 Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/reflect/value.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/reflect/value.go b/src/reflect/value.go
index d68f7ad2e6..0fc19ef101 100644
--- a/src/reflect/value.go
+++ b/src/reflect/value.go
@@ -2660,6 +2660,9 @@ func (v Value) UnsafePointer() unsafe.Pointer {
// Moreover, the Data field is not sufficient to guarantee the data
// it references will not be garbage collected, so programs must keep
// a separate, correctly typed pointer to the underlying data.
+//
+// Deprecated: this type should not be used, it exists only for
+// backward compatibility.
type StringHeader struct {
Data uintptr
Len int
@@ -2671,6 +2674,9 @@ type StringHeader struct {
// Moreover, the Data field is not sufficient to guarantee the data
// it references will not be garbage collected, so programs must keep
// a separate, correctly typed pointer to the underlying data.
+//
+// Deprecated: this type should not be used, it exists only for
+// backward compatibility.
type SliceHeader struct {
Data uintptr
Len int