-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reflect: roll back NumMethod change for interfaces #42123
Comments
Change https://golang.org/cl/264026 mentions this issue: |
See also #41882 |
If we decide not to change NumMethod, should we change the doc to make it match the code? (It currently says "NumMethod returns the number of exported methods in the type's method set.") |
Yes, we should correct the docs. |
Change https://golang.org/cl/264357 mentions this issue: |
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>
This reverts commit ab46b8b. The upstream change in Go1.16 has been rolled back. See golang/go#42123
) This reverts commit ab46b8b. The upstream change in Go1.16 has been rolled back. See golang/go#42123
NumMethod counts unexported methods for interface types. This behavior is documented in Type.NumMethod Fixes #42123 Change-Id: Ia5aba353a8cc64190c701d1521972d57e8903564 Reviewed-on: https://go-review.googlesource.com/c/go/+/396075 Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Cherry Mui <cherryyz@google.com>
The NumMethod change for interfaces (#22075) broke code in the standard library that assumed for interfaces that NumMethod() == 0 if and only if it is an empty interface. There is also a lot of code testing NumMethod() against 0 in the wild. See attached nummethod.txt. There are dups in that file but still, there's a bunch.
All that code will break with the change. We should probably roll it back and live with the difference between NumMethod on interfaces and NumMethod on non-interfaces.
nummethod.txt
The text was updated successfully, but these errors were encountered: