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.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Per @rsc 's comment, all proxies must use go mod download to ensure checksums are consistent amongst each other.
Therefore, Proxies that try to download modules through the go command should be able to understand errors in a programmatic way without having to parse text. Such errors can be:
Repository not found
The requested version does not exist
Authentication failure for private modules
Incorrect module path (does not begin with host name)
go mod download takes a -json flag which includes an Error string inside of it. I propose that we include an ErrorCode or at the very least be confident that the Error strings will be locked and not changed without notice.
Furthermore, some of the messages in the Error field are inaccurate, see below for details.
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?
go mod download -json github.com/gomods/moduledoesnotexist@latest
go mod download -json github.com/gomods/[email protected]
What did you expect to see?
Reliable code or message to say it's a bad module path
Reliable code or message to say it's a bad module path.
Reliable code or message to say that the module does not exist.
Reliable code or message to say that the module does not exist.
What did you see instead?
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\""
}
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)"
}
Incorrect error message same as no.1
{
"Path": "github.com/gomods/moduledoesnotexist",
"Version": "latest",
"Error": "invalid version \"latest\""
}
Inaccurate error message: it should tell us that the Repository is not found, instead of "invalid revision"
The text was updated successfully, but these errors were encountered:
mikioh
changed the title
[Proposal] cmd/go: return parseable errors for mod download
Proposal: cmd/go: return parseable errors for mod download
Mar 11, 2019
@bcmills the duplicate issue does not mention the inaccuracy of error messages that I stated above. Should I comment about them there, open a new issue, or are they not considered a problem?
@marwan-at-work Inaccurate error messages are definitely a problem. Could you please open a new issue about inaccurate go mod download errors specifically, and cc me?
Summary
Per @rsc 's comment, all proxies must use
go mod download
to ensure checksums are consistent amongst each other.Therefore, Proxies that try to download modules through the go command should be able to understand errors in a programmatic way without having to parse text. Such errors can be:
go mod download
takes a-json
flag which includes an Error string inside of it. I propose that we include anErrorCode
or at the very least be confident that theError
strings will be locked and not changed without notice.Furthermore, some of the messages in the Error field are inaccurate, see below for details.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
go mod download -json bad/path@latest
go mod download -json bad/[email protected]
go mod download -json github.com/gomods/moduledoesnotexist@latest
go mod download -json github.com/gomods/[email protected]
What did you expect to see?
What did you see instead?
latest
is not invalid.The text was updated successfully, but these errors were encountered: