1
0
mirror of https://github.com/golang/go synced 2024-11-26 17:46:57 -07:00

reflect: fix stale Value.Pointer comment

The comment claims that reflect users cannot obtain an unsafe.Pointer
without also importing the unsafe package explicitly.
This is no longer true now that the Value.UnsafePointer method
directly returns an unsafe.Pointer.

Change-Id: Ia5bf2e8aead681c8fac5b011129954d075ae5a43
Reviewed-on: https://go-review.googlesource.com/c/go/+/404396
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Joe Tsai 2022-05-05 10:20:09 -07:00 committed by Joseph Tsai
parent f469f20e79
commit 8298c545f3

View File

@ -2030,9 +2030,6 @@ func (v Value) OverflowUint(x uint64) bool {
// and make an exception.
// Pointer returns v's value as a uintptr.
// It returns uintptr instead of [unsafe.Pointer] so that
// code using reflect cannot obtain [unsafe.Pointer]s
// without importing the [unsafe] package explicitly.
// It panics if v's Kind is not Chan, Func, Map, Pointer, Slice, or UnsafePointer.
//
// If v's Kind is Func, the returned pointer is an underlying
@ -2596,7 +2593,6 @@ func (v Value) Uint() uint64 {
// and make an exception.
// UnsafeAddr returns a pointer to v's data, as a uintptr.
// It is for advanced clients that also import the [unsafe] package.
// It panics if v is not addressable.
//
// It's preferred to use uintptr(Value.Addr().UnsafePointer()) to get the equivalent result.