From 8298c545f384a6256962cb699f0c78306380279e Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 5 May 2022 10:20:09 -0700 Subject: [PATCH] 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 --- src/reflect/value.go | 4 ---- 1 file changed, 4 deletions(-) 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. -- 2.48.1