-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: should show error detail from module proxies #30748
Comments
If cmd/go shows the status, then the Proxy can define what each status means. For example, 404 means module not found while 400 means incorrect version etc. That said, I wouldn't mind it if Go exposed the response body, for pure debugging purposes although it might clutter the Go command output (maybe only behind |
That assumes that the go command can give very precise causes for an error, and even then I don't think it'd be enough. The reason I remembered to file this bug today is because Gerrit was having trouble on Friday. I think users are best served by an error more like the one they'd have seen going direct to the VCS:
than a generic "we think upstream is broken" error that provides no further detail for debugging.
If you have access and know where to look, sure. But in a sufficiently large organization, or for a user of a central proxy service, that's not so easy. |
It's not the go command that gives the error code, it's the GOPROXY that returns a status code and the go command outputs it for the client (you). Therefore, if you know what those error codes mean on the proxy side, then you should be able to understand what they mean. That said, it'd be nice to add the response body potentially behind a |
Is this planned for 1.13? (Current milestone says 1.13, but not sure if that’s accurate). More informative error messages would help with GOPROXY defaulting to enabled... |
Probably not for 1.13, but we'll see. It might be small enough and useful enough. |
This would be handy addition indeed. For instance, we have a local go modules proxy at my job where it serves from A user needs to set up gitlab token in order to have an access to gitlab repository:
And it would be nice to see sensible error output in this case in go get output: lack of token, invalid token, etc. I guess this would work: If go modules proxy response complies all these points
then go get will print that |
@sirkon, I don't think we even need What I have in mind is more like: if the content type is |
Change https://golang.org/cl/189781 mentions this issue: |
Change https://golang.org/cl/189782 mentions this issue: |
Change https://golang.org/cl/189778 mentions this issue: |
Change https://golang.org/cl/189783 mentions this issue: |
Change https://golang.org/cl/189780 mentions this issue: |
Change https://golang.org/cl/189779 mentions this issue: |
@bcmills, @jayconrod It looks like the related CL series is not going to be able to make the cut for 1.13? (Not sure of right CL(s), but maybe for example CL 189783). I can understand if the full solution might be too risky, but I wonder if there is some simpler type of solution, or at least mitigation? For example:
Here is a sample error message:
Right now, I think that contains the error-causing uri? However, it doesn't suggest visiting there, and that line doesn't say "error", and the key message is often nestled between other messages such that people don't always focus on the most pertinent line or otherwise recognize it as the real error. Also, is there something in the release notes currently on how to troubleshoot a proxy error? I don't quite have a handle on what classes of errors people are likely to see, but it seems there might be problems that have better errors if running with GOPROXY=direct, but then another class of problems that only occur when using the proxy and hence don't occur when running with GOPROXY=direct. CC @myitcv |
One other option could be emitting a generic error that suggests visiting https://golang.org/s/troubleshooting-proxy-errors or similar (which could be an exciting pilot of doing more of that in the future ;-) |
Typically, (We got a lot of reports of proxy-related confusion from users who had explicitly set |
Ah, that makes sense. The instances of confusing errors I have seen have almost certainly been with Go 1.12. |
The signature of parseMetaGoImports implies that it can return an error, but it has not done so since CL 119675. Restore the missing error check, and remove the named return-values to avoid reintroducing this bug in the future. Updates #30748 Updates #21291 Change-Id: Iab19ade5b1c23c282f3c385a55ed277465526515 Reviewed-on: https://go-review.googlesource.com/c/go/+/189778 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
… found Updates #30748 Change-Id: Ic93c68c1c4b2728f383edfdb06371ecc79a6f7b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/189779 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
Updates #30748 Updates #28459 Change-Id: I1c34b3dae0bf9361dba0dae66bb868901ecafe29 Reviewed-on: https://go-review.googlesource.com/c/go/+/189780 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
Change https://golang.org/cl/194817 mentions this issue: |
…leError VersionError wraps the given error in a ModuleError struct. If the given error is already a ModuleError for the same path and version, we now return it directly instead of wrapping. This makes it safer to call VersionError if we don't know whether a given error is already wrapped. Updates #30748 Change-Id: I41b23f6c3ead0ec382e848696da51f478da1ad35 Reviewed-on: https://go-review.googlesource.com/c/go/+/189781 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
…porting Updates #30748 Change-Id: I38a6cdc9c9b488fec579e6362a4284e26e0f526e Reviewed-on: https://go-review.googlesource.com/c/go/+/189782 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
Jay suggested this in CL 189780, and it seems semantically correct. As far as I can tell this has no impact one way or the other right now, but might prevent confusion (or at least give us more experience with error handling!) in future changes. Updates #30748 Updates #28459 Updates #30322 Change-Id: I5d7e9a08ea141628ed6a8fd03c62d0d3c2edf2bb Reviewed-on: https://go-review.googlesource.com/c/go/+/194817 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
When a module proxy returns an error, the go command shows only the HTTP status code.
In many cases the proxy will have more detail to report from the output of
go mod download
orgo list
. Proxy users should be able to see that; without it it's very hard to tell if the proxy is broken or if the user made a mistake.One suggestion was simply to add the response body to the error message if it's text/plain. Maybe there should be some rules about it being one line, or maybe proxy authors should just use their judgement.
@bcmills @jayconrod @marwan-at-work @rsc
The text was updated successfully, but these errors were encountered: