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: inaccurate go mod download errors #30743

Open
marwan-at-work opened this Issue Mar 11, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@marwan-at-work
Copy link
Contributor

marwan-at-work commented Mar 11, 2019

What version of Go are you using (go version)?

$ go version
go version go1.12 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

  1. go mod download -json bad/path@latest
  2. go mod download -json bad/path@v0.9.0
  3. go mod download -json github.com/gomods/moduledoesnotexist@latest
  4. go mod download -json github.com/gomods/moduledoesnotexist@v0.9.0

What did you expect to see?

  1. Reliable code or message to say it's a bad module path
  2. Reliable code or message to say it's a bad module path.
  3. Reliable code or message to say that the module does not exist.
  4. Reliable code or message to say that the module does not exist.

What did you see instead?

  1. Incorrect error message: it should prioritize saying that the module path is incorrect rather than that the version invalid. In fact, latest is not invalid.
{
	"Path": "github.com/gomods/moduledoesnotexist",
	"Version": "latest",
	"Error": "invalid version \"latest\""
}
  1. Correct error message, comparing against no.1 above, but it might be helpful to lock the message or introduce an error code.
{
	"Path": "bad/path",
	"Version": "v0.9.0",
	"Error": "unrecognized import path \"bad/path\" (import path does not begin with hostname)"
}
  1. Incorrect error message same as no.1
{
	"Path": "github.com/gomods/moduledoesnotexist",
	"Version": "latest",
	"Error": "invalid version \"latest\""
}
  1. Inaccurate error message: it should tell us that the Repository is not found, instead of "invalid revision"
{
	"Path": "github.com/gomods/moduledoesnotexist",
	"Version": "v0.9.0",
	"Error": "unknown revision v0.9.0"
}

cc: @jayconrod

@jayconrod

This comment has been minimized.

Copy link
Contributor

jayconrod commented Mar 11, 2019

Related #30134

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.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.