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 behavior on source files whose package can't be located #17516

Open
alandonovan opened this issue Oct 19, 2016 · 0 comments
Labels
Milestone

Comments

@alandonovan
Copy link
Contributor

@alandonovan alandonovan commented Oct 19, 2016

CL 30451 caused guru to silently treat a file that it can't locate beneath $GOPATH as if it belonged to an anonymous package (actually, one named "command-line-arguments") containing just that file. The behavior is convenient for some queries since it allows you to, for instance, describe arbitrary identifiers in any Go source file. However, for "reverse" queries such as "implements", its benefits are more dubious. Although it may cause "implements" facts within that single file to be reported, guru will fail to report "implements" facts about packages that import this one, since without knowing the true name of the query package, it cannot enumerate the packages that import it.

The tool should at least issue a warning* when it does this kind of guesswork, and should perhaps not do it at all for queries that use the import graph.

*though warnings are tricky because they may interfere with structured JSON output for editors that merge subcommands' stdout and stderr.

@quentinmit quentinmit added the NeedsFix label Oct 20, 2016
@quentinmit quentinmit added this to the Unreleased milestone Oct 20, 2016
@quentinmit quentinmit changed the title guru: confusing behavior on source files whose package can't be located x/tools/cmd/guru: confusing behavior on source files whose package can't be located Oct 20, 2016
@gopherbot gopherbot added the Tools label Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.