Groups
Groups
Sign in
Groups
Groups
golang-nuts
Conversations
About
Send feedback
Help
no returned name or package path from reflect.Type?
45 views
Skip to first unread message
Dan Kortschak
unread,
Nov 22, 2019, 4:06:50 PM
11/22/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Are reflect.Type.PkgPath/Name supposed to return strings for defined
types? There's nothing in the documentation that says they don't.
But
https://play.golang.org/p/8Jede-mimtA
and
https://play.golang.org/p/LT5m6yz0P5Y
don't show any output where I
would expect them to.
Dan
Ian Lance Taylor
unread,
Nov 22, 2019, 8:01:55 PM
11/22/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Dan Kortschak, golang-nuts
You have to be careful when using reflect with interface types. And a
pointer to a defined type doesn't have a name. Consider
https://play.golang.org/p/oXF6Ems5q_q
https://play.golang.org/p/dKHBkYyfVF6
Ian
Dan Kortschak
unread,
Nov 22, 2019, 8:06:21 PM
11/22/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Solved. Because they are not named types (being the pointer to the
type).
Dan Kortschak
unread,
Nov 22, 2019, 9:08:34 PM
11/22/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ian Lance Taylor, golang-nuts
Thanks. That continues to trip me up.
Reply all
Reply to author
Forward
0 new messages