-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: field lookup ignores methods that cancel fields (ambiguity is ignored) #5706
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Comments
We should not expect getting true for the second return value of FieldByName to imply that s.m will compile in the example above. There are other reasons we might not be able to SEE a field, even if it exists (e.g., it is unexported in a different package). The real problem, I think, is the comment at http://golang.org/src/pkg/reflect/type.go?#L860 that says "This uses the same condition that the Go language does", because it is not even close to true. I don't think people even want that to be true, unless they don't want to be able to use reflection to examine unexported fields of struct types from other packages. This is related to https://golang.org/issue/4876 as well, which has been marked fixed simply because the confusing behavior is now documented (by a comment in the code starting with "BUG", I might add). The real problem is that we don't seem to be sure whether we want reflection to show us all the internals or just the stuff we can get at. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
The text was updated successfully, but these errors were encountered: