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

cmd/go: 'go list -e' fails to report per-path results for nonexistent directories in module mode #28023

Closed
ianthehat opened this issue Oct 4, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@ianthehat
Copy link

commented Oct 4, 2018

If you pass a broken pattern, go list is supposed to succeed but have a "package" with the errors in it.
For non existing directory patterns (that start with ./) this works in non module mode, but fails in module mode.

If you are using GOPATH:

% go list -e -json ./non_existant_dir
{
        "ImportPath": "golang.org/x/tools/non_existant_dir",
        "Match": [
                "./non_existant_dir"
        ],
        "Incomplete": true,
        "Error": {
                "ImportStack": [
                        "golang.org/x/tools/non_existant_dir"
                ],
                "Pos": "",
                "Err": "cannot find package \"golang.org/x/tools/non_existant_dir\" in any of:\n\t/usr/local/google/home/iancottrell/work/go/src/golang.org/x/tools/non_existant_dir (from $GOROOT)\n\t/usr/local/google/home/iancottrell/go/base/src/golang.org/x/tools/non_existant_dir (from $GOPATH)\n\t/usr/local/google/home/iancottrell/work/gopath/src/golang.org/x/tools/non_existant_dir"
        }
}

If you are in a module:

% go list -e -json ./non_existant_dir
go: no such directory ./non_existant_dir

@ianthehat ianthehat added the modules label Oct 4, 2018

@bcmills bcmills added the NeedsFix label Oct 4, 2018

@bcmills bcmills added this to the Go1.12 milestone Oct 4, 2018

@bcmills bcmills changed the title cmd/go: go list fails the wrong way for non existent directories cmd/go: 'go list -e' fails to report per-path results for nonexistent directories in module mode Nov 14, 2018

@jayconrod

This comment has been minimized.

Copy link
Contributor

commented Nov 26, 2018

@bcmills I'm looking for some starter bugs to help me come up to speed on go list. Mind if I steal this one from you?

@jayconrod jayconrod assigned jayconrod and unassigned bcmills Nov 26, 2018

@bcmills

This comment has been minimized.

Copy link
Member

commented Nov 26, 2018

@jayconrod, all yours. Thanks for the help!

@gopherbot

This comment has been minimized.

Copy link

commented Nov 29, 2018

Change https://golang.org/cl/151800 mentions this issue: cmd/go: emit go list error for local non-existant packages

@gopherbot gopherbot closed this in c2412a7 Dec 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.