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: improve error message when "go get" encounters an unexpected import #4223

Open
gopherbot opened this issue Oct 9, 2012 · 12 comments
Milestone

Comments

@gopherbot
Copy link

by peter.waller:

Mailing list discussion is here:

https://groups.google.com/forum/?fromgroups=#!topic/golang-dev/4oYo21jEGuU

At maximum verbosity, `go get` does not give enough information as to what is causing
the failure if it encounters an invalid import. Ideally, it would always report the
package/file/line number where the invalid import is located. Otherwise it could be
buried somewhere deep in a dependency tree.

Example:

   $ go get -d -v -n github.com/go-gl/...
    import "sdl": import path doesn't contain a slash
    package sdl: unrecognized import path "sdl"

There is something in the code that raises this error talking about the error detail
being irrelevant. I don't understand why.

http://golang.org/src/cmd/go/vcs.go#L322
@minux
Copy link
Member

minux commented Oct 9, 2012

Comment 1:

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Dec 10, 2012

Comment 2:

Labels changed: added size-m.

@rsc
Copy link
Contributor

rsc commented Dec 30, 2012

Comment 3:

Labels changed: added priority-later, removed priority-triage.

@rsc
Copy link
Contributor

rsc commented Mar 12, 2013

Comment 4:

Labels changed: added go1.1maybe, removed go1.1.

@robpike
Copy link
Contributor

robpike commented May 18, 2013

Comment 5:

Labels changed: added go1.2maybe, removed go1.1maybe.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 6:

Labels changed: added feature.

@robpike
Copy link
Contributor

robpike commented Sep 3, 2013

Comment 7:

Not in time for 1.2.

Labels changed: removed go1.2maybe.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 8:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 9:

Labels changed: removed feature.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 10:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 11:

Labels changed: added repo-main.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@ysmolski
Copy link
Member

Example in the topic is not reproducible. So I made this:

% go get -d -v -n github.com/ysmolsky/import-error/...
github.com/ysmolsky/import-error (download)
# cd /Users/thorn/go/src/github.com/ysmolsky/import-error; git sync/update
package github.com/ysmolsky/import-error/t1
	imports sdl: unrecognized import path "sdl" (import path does not begin with hostname)

Reported error is somewhat better. It tells the package where problem happened. But it does not tell the file/line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants