godef
godef copied to clipboard
Printing the receiver for methods when printing types
Methods in Go have a receiver, and you can have multiple methods with the same name but a different receiver. In order to make it easier for users of godef to figure out the exact function the definition refers to, it would be useful if godef supplies some way to print the methods receiver along with it's type.
For example for:
package main
import (
"bufio"
"os"
)
func main() {
bufio.NewScanner(os.Stdin)
}
Running godef.exe -t -f foo.go bufio.Reader.ReadLine, gives you:
C:\Go\src\bufio\bufio.go:369:18
ReadLine func() (line []byte, isPrefix bool, err error)
While ReadLine has a b *Reader receiver which is unavailable in the current output.
This will make it easier to resolve https://github.com/Microsoft/vscode-go/issues/2107.
cc @ramya-rao-a