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: confusing error message when scope has trailing slash #14584

Closed
tbg opened this issue Mar 1, 2016 · 3 comments
Closed

x/tools/cmd/guru: confusing error message when scope has trailing slash #14584

tbg opened this issue Mar 1, 2016 · 3 comments

Comments

@tbg
Copy link

tbg commented Mar 1, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    1.6
  2. What operating system and processor architecture are you using (go env)?
    darwin
  3. What did you do?
go get github.com/tschottdorf/goplay && oracle \
  -pos=$GOPATH/src/github.com/tschottdorf/goplay/oracle_test_boom/main.go:#40 \
  callers github.com/tschottdorf/goplay/oracle_test_boom/
  1. What did you expect to see?
    The list of callers of (*X).Bar() (i.e., an empty list).
  2. What did you see instead?
/Users/tschottdorf/go/src/github.com/tschottdorf/goplay/oracle_test_boom/main_test.go:10:2: invalid operation: (&(main.X literal)) (value of type *github.com/tschottdorf/goplay/oracle_test_boom.X) has no field or method Foo
oracle: couldn't load packages due to errors: github.com/tschottdorf/goplay/oracle_test_boom/_test

In fact, this completely renders oracle unusable in source trees which have this phenomenon.

(cc: @mrtracy)

@ianlancetaylor ianlancetaylor added this to the Unreleased milestone Mar 1, 2016
@kostya-sh
Copy link
Contributor

@tschottdorf, oracle is no longer developed. It has been renamed to guru (golang.org/x/tools/cmd/guru) recently.

This problem exists in guru as well. The following command line can be used to reproduce:

guru -scope github.com/tschottdorf/goplay/oracle_test_boom/ callers $GOPATH/src/github.com/tschottdorf/goplay/oracle_test_boom/main.go:#40

@alandonovan
Copy link
Contributor

Thanks for the bug report.

I notice that the trailing slash in the -scope argument seems to confuse the tool:

$ guru -scope github.com/tschottdorf/goplay/oracle_test_boom/ callers $GOPATH/src/github.com/tschottdorf/goplay/oracle_test_boom/main.go:#40
/usr/local/google/home/adonovan/got3/src/github.com/tschottdorf/goplay/oracle_test_boom/main_test.go:10:2: invalid operation: (&(main.X literal)) (value of type *github.com/tschottdorf/goplay/oracle_test_boom.X) has no field or method Foo
guru: couldn't load packages due to errors: github.com/tschottdorf/goplay/oracle_test_boom/_test

Removing the slash seems to be an effective workaround:

$ guru -scope github.com/tschottdorf/goplay/oracle_test_boom callers $GOPATH/src/github.com/tschottdorf/goplay/oracle_test_boom/main.go:#40
/usr/local/google/home/adonovan/got3/src/github.com/tschottdorf/goplay/oracle_test_boom/main.go:5:10: (github.com/tschottdorf/goplay/oracle_test_boom.X).Bar is called from these 0 sites:

@alandonovan alandonovan changed the title x/tools/cmd/oracle: fails when test defines method on non-test receiver x/tools/cmd/guru: confusing error message when scope has trailing slash Mar 4, 2016
@gopherbot
Copy link

CL https://golang.org/cl/30452 mentions this issue.

@golang golang locked and limited conversation to collaborators Oct 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants