]> Cypherpunks repositories - gostls13.git/commitdiff
reflect: update NumMethod doc for interface type
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 22 Oct 2020 14:52:50 +0000 (21:52 +0700)
committerRuss Cox <rsc@golang.org>
Tue, 3 Nov 2020 00:50:57 +0000 (00:50 +0000)
Updates #42123

Change-Id: Ieb43b65c88d15b2475b6f3dd9672c44e7831cc34
Reviewed-on: https://go-review.googlesource.com/c/go/+/264357
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/reflect/type.go

index a3a616701b9abf61c53664d82f1e85884a2ca0ab..a2076bb3f1bf9dbf676107ef698aa09ecf1d38b0 100644 (file)
@@ -50,13 +50,13 @@ type Type interface {
        // It panics if i is not in the range [0, NumMethod()).
        //
        // For a non-interface type T or *T, the returned Method's Type and Func
-       // fields describe a function whose first argument is the receiver.
+       // fields describe a function whose first argument is the receiver,
+       // and only exported methods are accessible.
        //
        // For an interface type, the returned Method's Type field gives the
        // method signature, without a receiver, and the Func field is nil.
        //
-       // Only exported methods are accessible and they are sorted in
-       // lexicographic order.
+       // Methods are sorted in lexicographic order.
        Method(int) Method
 
        // MethodByName returns the method with that name in the type's
@@ -69,7 +69,9 @@ type Type interface {
        // method signature, without a receiver, and the Func field is nil.
        MethodByName(string) (Method, bool)
 
-       // NumMethod returns the number of exported methods in the type's method set.
+       // NumMethod returns the number of methods accessible using Method.
+       //
+       // Note that NumMethod counts unexported methods only for interface types.
        NumMethod() int
 
        // Name returns the type's name within its package for a defined type.