Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
reflect: clarify behavior for unexported names #4876
Comments
adonovan
commented
Feb 22, 2013
(gri -> rsc) Owner changed to @rsc. |
adonovan
commented
Feb 22, 2013
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. |
adonovan
added
fixed
Documentation
labels
Sep 13, 2013
adonovan
assigned
rsc
Sep 13, 2013
rsc
added this to the Go1.2 milestone
Apr 14, 2015
rsc
removed
the
go1.2
label
Apr 14, 2015
gopherbot
locked and limited conversation to collaborators
Jun 24, 2016
gopherbot
added
the
FrozenDueToAge
label
Jun 24, 2016
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
adonovan commentedFeb 22, 2013