From: Joe Tsai Date: Thu, 5 May 2022 17:20:09 +0000 (-0700) Subject: reflect: fix stale Value.Pointer comment X-Git-Tag: go1.20rc1~1699 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8298c545f384a6256962cb699f0c78306380279e;p=gostls13.git 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 Run-TryBot: Cuong Manh Le TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Reviewed-by: Than McIntosh --- diff --git a/src/reflect/value.go b/src/reflect/value.go index d8479c64ef..02add5a768 100644 --- a/src/reflect/value.go +++ b/src/reflect/value.go @@ -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.