-
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: inconsistent handling of embed/sticky read-only flag #22031
Comments
I think the issue has to do with the distinction between When we access an unexported non-embedded field, we set When we access an unexported embedded field though, we set The issue is when we call I think operations like |
Yes, that is exactly the problem. Various places in reflect/value.go need to change from
|
Yeah, I think |
Change https://golang.org/cl/66331 mentions this issue: |
In the following program, the first call to
v.Close()
works fine. The second panics sayingThe difference is that one value is reached via an embedded unexported field, and the other is reached via a normal unexported field. It makes sense for the handling of a field of an unexported embedded struct to be treated as exported, but in an example like this the special handling is carrying through a map index operation. That does not make sense, and does not correspond to how the language behaves.
CC @mpvl
The text was updated successfully, but these errors were encountered: