Skip to content

reflect: confusing (Value).String() result for methods #7859

@gopherbot

Description

@gopherbot

by alan@alandonovan.net:

The String() method of reflect.Value prints a surprising type for method values returned
by MethodByName: instead of the type of the func, it returns the type of the receiver. 
I think String() should use alternative logic if flagMethod is set.

http://play.golang.org/p/cXCMW1iCCT

Got:
main.C: <main.C Value>
func(): <main.C Value>

Want:
main.C: <main.C Value>
func(): <func() Value>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions