Skip to content
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

x/tools/cmd/guru: better help for implements #20024

Open
kevinburke opened this issue Apr 18, 2017 · 7 comments
Open

x/tools/cmd/guru: better help for implements #20024

kevinburke opened this issue Apr 18, 2017 · 7 comments
Labels
Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@kevinburke
Copy link
Contributor

I'm trying to find all interfaces in the standard library that implement io.Reader or are called NewDecoder. I thought guru would be able to help with this but I was unable to figure out how to use it correctly.

  • guru help implements displays the generic help text.

  • guru implements -h or guru implements help print:

    $ guru implements -h
    guru: bad position syntax "-h"
    
  • guru implements -scope github.com/golang/go/src/... io.Reader prints simply:

    $ guru implements -scope github.com/golang/go/src/... io.Reader
    Run 'guru -help' for more information.
    

Reading the help text more carefully now, I see that I'm supposed to pass a filename and a line number as the position argument. This is a little confusing, I think, since other "implements" tools (dominikh/implements, "go oracle") said that this was a drop in replacement, and neither of them required filenames or line numbers, I don't think.

Maybe I am an idiot and maybe I should read more carefully but I wasn't able to find examples of successful usage when searching Google, and I wasn't able to get it to work, and it's possible that other users are having the same problems.

@gopherbot gopherbot added this to the Unreleased milestone Apr 18, 2017
@stemar94
Copy link

Although guru is a command-line tool, it is intended to be executed by your editor. The output of most guru queries is a list of diagnostics, each prefixed by a source file name, line number, and column number, similar to the diagnostic output of a typical compiler. Most editors can display compiler output in a buffer so that clicking on a diagnostic opens the relevant source file at the right position.

User manual: http://golang.org/s/using-guru

Was listed in the guru -help page.

@kevinburke
Copy link
Contributor Author

I saw that link and it's also unhelpful for the purpose described in the ticket, since the only described usage for "implements" is a GIF of highlighting text in a text editor

@stemar94
Copy link

Seems like you didn't even read my quote, guess I found where the issue is...

Although guru is a command-line tool, it is intended to be executed by your editor.

The output of most guru queries is a list of diagnostics, each prefixed by a source file name, line number, and column number, similar to the diagnostic output of a typical compiler. Most editors can display compiler output in a buffer so that clicking on a diagnostic opens the relevant source file at the right position.

User manual: http://golang.org/s/using-guru

Was listed in the guru -help page.

@kevinburke
Copy link
Contributor Author

kevinburke commented Apr 18, 2017 via email

@stemar94
Copy link

So that's then the fault of those tool maintainers or isn't it?

@a-h
Copy link
Contributor

a-h commented Oct 1, 2017

I think it's a good idea to improve the help here, or make the tool able to support passing in type names, or line and column numbers rather than file byte offsets. The command help doesn't describe the supported formats either.

Regardless of who's fault it is, it's confusing to people who are trying to use Go if various documents are pointing them at guru and guru doesn't solve their problem, so I think it would be appropriate to improve the documentation to reduce that confusion.

Regardless, this StackOverflow answer helped me: https://stackoverflow.com/a/31759333/1037465

It turns out that the local godoc -http=":8080" -analysis="type" command also enables searching for implementations (the online documentation doesn't) and you can do it from the Web browser.

screen shot 2017-10-01 at 18 04 17

I'd rather be able to type guru implements io.ReadSeeker though.

@wenjianhn
Copy link

Correction: guru requires an offset instead of a line number.

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

5 participants