-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: don't access the network for go mod tidy
diagnostics
#38462
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
Comments
Following https://golang.org/cl/228235, the regtests use a proxy within our control. If we have examples of how gopls breaks without a network connection, we should be able to reproduce. |
@findleyr
|
Change https://golang.org/cl/274120 mentions this issue: |
For users with poor network connections, go command invocations that access the network may hang up for long periods of time. Even for users with good network connections, accessing proxy.golang.org or github can take a few seconds, which is a long time to lock up an editor. Disable network access via GOPROXY=off when running most go commands. There are two notable exceptions. First, the initial workspace load is allowed, though subsequent loads are not. My reasoning is that if the user is opening a project they've just downloaded, they probably expect to fetch its dependencies. (Also, it's convenient to keep the regtests going.) The second is the go mod tidy diagnostics, which I hope to address in a later change. All the other commands that access the network are at the user's request. When the workspace load fails due to a dependency that hasn't been downloaded, we present a quick fix on the go.mod line to do so. The only way that happens is if there's a manual modification to the go.mod file, since all of the other quick fixes will do the download. So I don't think there's a need to present the fix anywhere else. Updates golang/go#38462. Change-Id: I470bc1ba790db7c1afee54d0b28fa0c6fd203fb9 Reviewed-on: https://go-review.googlesource.com/c/tools/+/274120 Trust: Heschi Kreinick <[email protected]> Run-TryBot: Heschi Kreinick <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]> Reviewed-by: Robert Findley <[email protected]>
I believe the only remaining task here is to remove network access for the @heschik, is there anything else I'm missing? |
That's it as far as I know. |
go mod tidy
diagnostics
For users with poor network connections, go command invocations that access the network may hang up for long periods of time. Even for users with good network connections, accessing proxy.golang.org or github can take a few seconds, which is a long time to lock up an editor. Disable network access via GOPROXY=off when running most go commands. There are two notable exceptions. First, the initial workspace load is allowed, though subsequent loads are not. My reasoning is that if the user is opening a project they've just downloaded, they probably expect to fetch its dependencies. (Also, it's convenient to keep the regtests going.) The second is the go mod tidy diagnostics, which I hope to address in a later change. All the other commands that access the network are at the user's request. When the workspace load fails due to a dependency that hasn't been downloaded, we present a quick fix on the go.mod line to do so. The only way that happens is if there's a manual modification to the go.mod file, since all of the other quick fixes will do the download. So I don't think there's a need to present the fix anywhere else. Updates golang/go#38462. Change-Id: I470bc1ba790db7c1afee54d0b28fa0c6fd203fb9 Reviewed-on: https://go-review.googlesource.com/c/tools/+/274120 Trust: Heschi Kreinick <[email protected]> Run-TryBot: Heschi Kreinick <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]> Reviewed-by: Robert Findley <[email protected]>
Change https://golang.org/cl/289309 mentions this issue: |
A few reports of issues with
gopls
when the user has no internet (one on Slack, one on microsoft/vscode-go#3105).I wonder if there is a way we can have a regression test this - maybe by configuring something in the environment? @findleyr
The text was updated successfully, but these errors were encountered: