-
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: clarify behavior for unexported names #4876
Labels
Milestone
Comments
(gri -> rsc) Owner changed to @rsc. |
Perhaps the most correct solution is to add another method: // Precondition: !ast.IsExported(fieldname) <=> pkgpath != "" FieldFieldByQualifiedName(pkgpath, fieldname string) which also compares the StructField.PkgPath, not just the name. The first method could be changed in one of the following ways: (a) document its tricky behaviour but remain unchanged. (b) reject lowercase field names. (b) accept lowercase field names, and in that case reflect over the callstack (!) and extract the default package name from the calling frame, and then pass that to the qualified 2-arg function. |
This issue was closed by revision 7fb3d8e. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: