From e0cd90528e1ea9d8e7362391b645178fcd0a7e03 Mon Sep 17 00:00:00 2001 From: cui fliter Date: Fri, 3 Nov 2023 19:33:51 +0800 Subject: [PATCH] reflect: add available godoc link Change-Id: Ib199ce1a781e8e3a66d3dc8bda617e6bc30b290e Reviewed-on: https://go-review.googlesource.com/c/go/+/539578 Auto-Submit: Ian Lance Taylor Run-TryBot: shuang cui Reviewed-by: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI TryBot-Result: Gopher Robot Reviewed-by: Dmitri Shuralyov Reviewed-by: qiulaidongfeng <2645477756@qq.com> --- src/reflect/arena.go | 4 ++-- src/reflect/makefunc.go | 6 +++--- src/reflect/type.go | 2 +- src/reflect/value.go | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/reflect/arena.go b/src/reflect/arena.go index cac1a1da5e..769f8ebc74 100644 --- a/src/reflect/arena.go +++ b/src/reflect/arena.go @@ -8,9 +8,9 @@ package reflect import "arena" -// ArenaNew returns a Value representing a pointer to a new zero value for the +// ArenaNew returns a [Value] representing a pointer to a new zero value for the // specified type, allocating storage for it in the provided arena. That is, -// the returned Value's Type is PointerTo(typ). +// the returned Value's Type is [PointerTo](typ). func ArenaNew(a *arena.Arena, typ Type) Value { return ValueOf(arena_New(a, PointerTo(typ))) } diff --git a/src/reflect/makefunc.go b/src/reflect/makefunc.go index 2ed7f38905..5da6cd2ec7 100644 --- a/src/reflect/makefunc.go +++ b/src/reflect/makefunc.go @@ -22,7 +22,7 @@ type makeFuncImpl struct { fn func([]Value) []Value } -// MakeFunc returns a new function of the given Type +// MakeFunc returns a new function of the given [Type] // that wraps the function fn. When called, that new function // does the following: // @@ -30,14 +30,14 @@ type makeFuncImpl struct { // - runs results := fn(args). // - returns the results as a slice of Values, one per formal result. // -// The implementation fn can assume that the argument Value slice +// The implementation fn can assume that the argument [Value] slice // has the number and type of arguments given by typ. // If typ describes a variadic function, the final Value is itself // a slice representing the variadic arguments, as in the // body of a variadic function. The result Value slice returned by fn // must have the number and type of results given by typ. // -// The Value.Call method allows the caller to invoke a typed function +// The [Value.Call] method allows the caller to invoke a typed function // in terms of Values; in contrast, MakeFunc allows the caller to implement // a typed function in terms of Values. // diff --git a/src/reflect/type.go b/src/reflect/type.go index 4e650f765c..4a8c5a1e09 100644 --- a/src/reflect/type.go +++ b/src/reflect/type.go @@ -962,7 +962,7 @@ type StructTag string // If there is no such key in the tag, Get returns the empty string. // If the tag does not have the conventional format, the value // returned by Get is unspecified. To determine whether a tag is -// explicitly set to the empty string, use Lookup. +// explicitly set to the empty string, use [StructTag.Lookup]. func (tag StructTag) Get(key string) string { v, _ := tag.Lookup(key) return v diff --git a/src/reflect/value.go b/src/reflect/value.go index 5fa2daae86..9cde9d0975 100644 --- a/src/reflect/value.go +++ b/src/reflect/value.go @@ -24,7 +24,7 @@ import ( // inappropriate to the kind of type causes a run time panic. // // The zero Value represents no value. -// Its IsValid method returns false, its Kind method returns Invalid, +// Its [Value.IsValid] method returns false, its Kind method returns [Invalid], // its String method returns "", and all other methods panic. // Most functions and methods never return an invalid value. // If one does, its documentation states the conditions explicitly. @@ -1541,7 +1541,7 @@ func (v Value) InterfaceData() [2]uintptr { // a chan, func, interface, map, pointer, or slice value; if it is // not, IsNil panics. Note that IsNil is not always equivalent to a // regular comparison with nil in Go. For example, if v was created -// by calling ValueOf with an uninitialized interface variable i, +// by calling [ValueOf] with an uninitialized interface variable i, // i==nil will be true but v.IsNil will panic as v will be the zero // Value. func (v Value) IsNil() bool { @@ -1566,7 +1566,7 @@ func (v Value) IsNil() bool { // IsValid reports whether v represents a value. // It returns false if v is the zero Value. -// If IsValid returns false, all other methods except String panic. +// If [Value.IsValid] returns false, all other methods except String panic. // Most functions and methods never return an invalid Value. // If one does, its documentation states the conditions explicitly. func (v Value) IsValid() bool { @@ -2503,7 +2503,7 @@ func (v Value) SetUint(x uint64) { } // SetPointer sets the [unsafe.Pointer] value v to x. -// It panics if v's Kind is not UnsafePointer. +// It panics if v's Kind is not [UnsafePointer]. func (v Value) SetPointer(x unsafe.Pointer) { v.mustBeAssignable() v.mustBe(UnsafePointer) @@ -3054,7 +3054,7 @@ const ( // then the case is ignored, and the field Send will also be ignored and may be either zero // or non-zero. // -// If Dir is SelectRecv, the case represents a receive operation. +// If Dir is [SelectRecv], the case represents a receive operation. // Normally Chan's underlying value must be a channel and Send must be a zero Value. // If Chan is a zero Value, then the case is ignored, but Send must still be a zero Value. // When a receive operation is selected, the received Value is returned by Select. @@ -3281,7 +3281,7 @@ func Zero(typ Type) Value { var zeroVal [abi.ZeroValSize]byte // New returns a Value representing a pointer to a new zero value -// for the specified type. That is, the returned Value's Type is PointerTo(typ). +// for the specified type. That is, the returned Value's Type is [PointerTo](typ). func New(typ Type) Value { if typ == nil { panic("reflect: New(nil)")