Skip to content

Commit ebc1b8e

Browse files
cuonglmrsc
authored andcommitted
reflect: update NumMethod doc for interface type
Updates #42123 Change-Id: Ieb43b65c88d15b2475b6f3dd9672c44e7831cc34 Reviewed-on: https://go-review.googlesource.com/c/go/+/264357 Trust: Cuong Manh Le <[email protected]> Run-TryBot: Cuong Manh Le <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Russ Cox <[email protected]>
1 parent 3a76627 commit ebc1b8e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/reflect/type.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ type Type interface {
5050
// It panics if i is not in the range [0, NumMethod()).
5151
//
5252
// For a non-interface type T or *T, the returned Method's Type and Func
53-
// fields describe a function whose first argument is the receiver.
53+
// fields describe a function whose first argument is the receiver,
54+
// and only exported methods are accessible.
5455
//
5556
// For an interface type, the returned Method's Type field gives the
5657
// method signature, without a receiver, and the Func field is nil.
5758
//
58-
// Only exported methods are accessible and they are sorted in
59-
// lexicographic order.
59+
// Methods are sorted in lexicographic order.
6060
Method(int) Method
6161

6262
// MethodByName returns the method with that name in the type's
@@ -69,7 +69,9 @@ type Type interface {
6969
// method signature, without a receiver, and the Func field is nil.
7070
MethodByName(string) (Method, bool)
7171

72-
// NumMethod returns the number of exported methods in the type's method set.
72+
// NumMethod returns the number of methods accessible using Method.
73+
//
74+
// Note that NumMethod counts unexported methods only for interface types.
7375
NumMethod() int
7476

7577
// Name returns the type's name within its package for a defined type.

0 commit comments

Comments
 (0)