]> Cypherpunks repositories - gostls13.git/commitdiff
reflect: fix stale Value.Pointer comment
authorJoe Tsai <joetsai@digital-static.net>
Thu, 5 May 2022 17:20:09 +0000 (10:20 -0700)
committerJoseph Tsai <joetsai@digital-static.net>
Thu, 11 Aug 2022 16:59:34 +0000 (16:59 +0000)
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>
src/reflect/value.go

index d8479c64ef9b285fd64f04e7388cf9da26d8af3a..02add5a768437fee8748e4d87742b63c66334814 100644 (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.