-
Notifications
You must be signed in to change notification settings - Fork 647
Infinite Getting code actions from ''Go', 'Go', 'Go'' on save #3105
Comments
This is another case of #3063 after the recent VS Code includes a hint on which extension is the slow one. (I admit the error message is funny.) Since you are reporting auto-completion is not working, I am guessing the tools running behind have difficulties in processing your workspace. @zkcrescent can you share a bit more info to triage your case?
|
Not OP but running into the same issue, beyond that I had to enable gopls manually to get autocomplete to work. This issue shows up every couple saves or so.
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/mike/Library/Caches/go-build"
GOENV="/Users/mike/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/mike/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.14/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.14/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/kr/p8h7z50n2g30v4_5s7ktzn4h0000gn/T/go-build915584336=/tmp/go-build -gno-record-gcc-switches -fno-common"
|
@PapayaJuiceEQ What do you mean by "enabling Did you see anything before the context canceled error flood? The popup occurs because formatting & code action triggered during file save took long time. note: The |
@hyangah Upon initial installation of the vscode-go plugin and installing all of the gotools it prompted, autocomplete still didn't work even after restart. I had to run the I've since opened and closed a few VSC windows and haven't seen the same issue since yesterday, but here are some similar log lines I found:
Please let me know if there's anything else I can help with |
@PapayaJuiceEQ: Can you add the recommended flags to your settings and capture the |
@stamblerre not sure if this will help but after following the instructions from the link above, I got several errors from
Happy to provide more information if you need it. |
Thanks, @lucascarvalho! Could you share the complete logs from when you see this error pop-up? It would be helpful to see the |
Had this problem too. It turns out in my case, it was caused by me updating to Go 1.14 from 1.12, and I was using a private repository. I had to set GOPRIVATE to include dev.azure.com - then it started working again for me. Alternatively I could have set GOSUMDB to off and GOPROXY to direct, but the GOPRIVATE way seems better. This could have been a coincidence though, but I am pretty sure this was the reason. |
Same problem here. I'm using VSCode + WSL with modules. go version
go env
gopls Ouput
Go output
Log (Extension Host) Nothing of note. The file I am trying to save package store
import (
"context"
)
func (db *PGStore) GetLadder(ctx context.Context, ladderID string) (*Ladder, error) {
var ladder Ladder
if err := db.GetContext(ctx, &ladder, "SELECT * FROM ladders WHERE id=$1", ladderID); err != nil {
return nil, err
}
return &ladder, nil
}
func (db *PGStore) GetLadders(ctx context.Context) ([]*Ladder, error) {
ladders := make([]*Ladder, 0)
if err := db.SelectContext(ctx, &ladders, "SELECT * FROM ladders"); err != nil {
return nil, err
}
return ladders, nil
}
func (db *PGStore) InsertLadder(ctx context.Context, ladder *Ladder) (*Ladder, error) {
q := `
INSERT INTO ladders
(name)
VALUES (:name)
`
rows, err := db.NamedQueryContext(ctx, q, ladder)
if err != nil {
return nil, err
}
if rows.Next() {
rows.Scan(&ladder.ID)
rows.Close()
}
return ladder, nil
} VSCode config
|
"go.useLanguageServer": false, |
@albshin: This log doesn't seem to be complete. Do you mind sharing the entire contents? You can also try running @supa-freak: If you're interested in trying the language server again, I'd be happy to investigate the issue. |
EDIT: On a whim I moved everything over from Windows to the WSL filesystem and everything seems to work now. I did try @stamblerre Sorry about that. I believe this should be the full log now.
gopls check
|
Thanks for posting that! It looks you're developing a project outside of GOPATH, but I'm not noticing any reason why Windows would be causing an issue here, but FWIW, VS Code recently eliminated the |
I ran into this error too and have a thing to add which might function as a clue. When the go language server is running, it seems to ignore settings files in visual studio code. For instance if you have "[go]:{"editor.formatOnSave":false} in your setting file because I habitually hit ctrl-s and end up removing a package import and typed code I need in the immediate future, it will ignore that setting and use the defaults. I tested this by typing in something like
And watching it delete "log" a few times, while one or both of my settings.json files read as:
Thinking about logging this as another issue, but this seems to be related. Running the program from a not-cold-boot, I definitely experienced a 15-45 second delay on a trivial file for gopls to kick in and take effect. From a cold boot, that went down to 0.5-1.5 seconds. It might be that when I restarted a new version came into effect, I definitely downloaded the latest code trying to fix this. But I kind of doubt that - it seems more likely it came into conflict with another language server... I like to mess around with different programming languages in my free time. Logged output while the program was deleting things it shouldn't with gopls:
With -rpc.trace:
For now the most effective workaround is disabling the server, in light of the fact it's doing more than running a bit slow and the other default language tools appear to be supporting the packages I imported. This project does have a go.mod file. |
I ran |
What helped me was disabling the tracing and debug server from
However saving multiple files still queues up a lot of popups sometimes. So there's still something fishy here. |
I too have the same problem. I updated golang to 1.14.1 and I am having problem saving the file. I get the exact same error. |
@CoffeeCecil: Do you mind filing separate issues for the problems you mentioned?
@albshin: Can you share the output of If anyone on this thread can point to a public package that reproduces this issue consistently, I'd really appreciate it. It's caused by a new behavior in VS Code and is generally difficult to track down. |
@stamblerre FYI, it does not happen all the time on my local environment. I would say that it happen 60% of the times when I try to save a .go file. |
@lucascarvalho: If you can get your |
/home/albertshin/go/bin/gopls -rpc.trace -v check /mnt/c/Git/ladder/store/ladder_store.go
2020/04/02 15:09:09 Info:2020/04/02 15:09:09 Build info
----------
golang.org/x/tools/gopls v0.3.4
golang.org/x/tools/[email protected] h1:4GC7q/pXQ/tsxHBGVdsMdlB4gCxVC06m/7rIXg1Px4E=
github.com/BurntSushi/[email protected] h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/sergi/[email protected] h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
golang.org/x/[email protected] h1:WG0RUwxtNT4qqaXX3DPA8zHFNm/D9xaBpxzHt1WcA/E=
golang.org/x/[email protected] h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/[email protected] h1:hKrQy/q8/Xivoqgw6nGiz1jqpn1WGBLDcWLZwW0983E=
golang.org/x/[email protected] h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
honnef.co/go/[email protected] h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U=
mvdan.cc/xurls/[email protected] h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA=
Go info
-------
go version go1.14 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/albertshin/.cache/go-build"
GOENV="/home/albertshin/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/albertshin/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.14"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.14/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/mnt/c/Git/ladder/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build261583592=/tmp/go-build -gno-record-gcc-switches"
2020/04/02 15:09:10 Info:2020/04/02 15:09:10 go/packages.Load
snapshot = 0
query = [./... builtin]
packages = 5 |
I'm having the same issue, break vscode. Can't save the file anymore. I'm using the vim plugin which makes matters even worse because vscode won't respond correctly the vim commands either. |
@gustavooferreira: Are you using the language server? If so, can you share your @albshin: It does look like your project is configured correctly, so I'd expect things to work correctly the majority of the time. Is that the case, or are you still having frequent issues with the pop-ups? |
Still happens to me consistenly on MacOS and Windows 10. I tend to see a lot of these in the gopls logs:
Sometimes it's just a delay of 1-10 seconds to save files, other times it gets stuck indefinitely. |
@patrikeh: Thanks for the log, but it looks like you may want to add |
Hi @stamblerre I was using the language server and then disabled it to see if the problem would go away, but the problem persisted. When I press VScode also crashes sometimes, forcing me to close it and open again. This all starts well, I think it's after a few seconds when it goes to save the file (autosave enabled) gopls runs and makes vscode freak out. My gopls version: I'm attaching the gopls log output as it is too big to just paste it here. This problem basically makes vscode unusable as it's constantly acting weird and crashing. |
Thanks for the report, @gustavooferreira. Unfortunately, it's a little difficult to understand which problems are caused by It sounds like you disabled |
Thank you @stamblerre, I actually think this is probably a problem with vscode itself, as my laptop still had 1.42.1 version installed on it and was showing no problems, so I decided to downgrade it on my desktop as well and now everything seems to be working fine. I'll still with this version for awhile. Anyway, thank you for your help! |
This is indeed specific to later versions of VS Code, but I'd still recommend figuring out the issue, since VS Code is released fairly frequently. Happy to continue investigating if you're willing to do so. |
Same to me. Having this issue in 1.43.*. Tried many settings but the only way to solve it is rolling back to 1.42.1. |
I'm afraid that using an old VS Code version is just a temporary fix for this problem. If anyone is interested in investigating this issue, I can take a look at any logs. |
You are most definitely right @stamblerre. I personally just went with this route as I use vscode at work as well and I needed to solve this as quickly as possible, but I'll definitely upgrade vscode to the latest version again and check the various logs to see if we can spot any anomalies either with gopls, any other extension or even with vscode itself. |
Hi I have exact same issue on MacOs 10.13.6 and VsCode Version: 1.43.2 and go version 'go1.14.1 darwin/amd64' I tried to disable all the linting and formating in vscode:
but vscode still has the same issue: |
I'm seeing the same issue, here are the logs from when it was stuck 2020/04/08 10:46:02 : context canceled Here are my extensions: |
Unfortunately, the context canceled errors aren't super useful information - we've stopped logging them in I've heard reports that people have noticed that this issue can be caused by the Go Group Imports extension, so if you're using that, I'd suggest trying to disable it. |
After upgrading vscode from 1.42 to 1.44, golang from 1.13.6 to 1.13.10, go plugin is no change, I can't save go file as used it works fine. Follow #3105 (comment) ,
Disable
Found some log
|
@stamblerre
and found Today, I move to the network which needs http proxy, My guess is
PS. Within the network needs proxy, I configured the http proxy in vs code, and installed all go tools successfully. |
one more message. When my local vendor folder has NO cache for one package, infinite go again, after remove that package, I guess vscode |
@mingoal that is an interesting use case. Does explicitly setting @stamblerre Does |
Just filed golang/go#38462 to make sure that we test this case. @mingoal can you please follow up on that issue? This issue has gotten very long and complicated, so I'm going to close it in favor of #3179, which may be easier for people to read through. |
Duplicate of #3179 |
@hyangah it works on my machine vscode settings.json: "go.toolsEnvVars": {
"HTTPS_PROXY": "https.proxy.address",
"HTTP_PROXY": "https.proxy.address"
} |
Hello, Also have the same issue. At this time Virtual Studio Code is unusable. Saving 'file name.go':Getting code actions from "Go" (configure) tried to change "go.useLanguageServer": to false. what's wrong.. |
VSCode with vscode-go installed is currently unusable for me as well, as any file save ends up in an infinite loop. Downgrading to version 0.13.1 of the extension solved the problem for me. Obviously only a temporary fix. For those, like me, who have never downgraded an extension before, here's how to do it:
|
when i'm trying to save go files, this will appear and it is infinitely running. How can I fix this? btw, auto-completion is not working.
Thanks for your help.
The text was updated successfully, but these errors were encountered: