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/go/packages: clarify error invariants #28231

Open
alandonovan opened this issue Oct 16, 2018 · 0 comments
Open

x/tools/go/packages: clarify error invariants #28231

alandonovan opened this issue Oct 16, 2018 · 0 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@alandonovan
Copy link
Contributor

alandonovan commented Oct 16, 2018

$ ./gopackages -mode=allsyntax "" "nonesuch"
Go package "_/home/adonovan/got/src/golang.org/x/tools": (has errors)
        has complete exported type info
        -: no Go files in /home/adonovan/got/src/golang.org/x/tools

Go package "nonesuch": (has errors)
        has complete exported type info
        -: cannot find package "nonesuch" in any of:
        /home/adonovan/goroot/src/nonesuch (from $GOROOT)
        /home/adonovan/go/src/nonesuch (from $GOPATH)

packages.Load("nonesuch") and Load("") both return a Package, presumably just as a place to hold errors. The package Name field is empty, which is a good clue that the package doesn't exist, and the Errors slice is non-empty. However, the Types field is non-nil and Complete(), which causes the gopackages diagnostic/example tool to report "has complete exported type info" for a package that doesn't exist.

The task of this issue is to clarify which fields can be relied upon in each error scenario and to improve the output and logic of the gopackages tool to reflect this.

@gopherbot gopherbot added this to the Unreleased milestone Oct 16, 2018
@FiloSottile FiloSottile added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 19, 2018
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 12, 2019
@rsc rsc unassigned matloob Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants