Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

I get an infinite save pop up while saving a go file #3141

Closed
vikram-rawat opened this issue Mar 31, 2020 · 14 comments
Closed

I get an infinite save pop up while saving a go file #3141

vikram-rawat opened this issue Mar 31, 2020 · 14 comments
Labels

Comments

@vikram-rawat
Copy link

I am working on Windows system. My Issue is exactly like this one #3105

It all started yesterday when I updated go to 1.4.1 and then vscode asked me to update a few pacakges.

This is the result of gopls

2020/03/31 13:05:10 Info:2020/03/31 13:05:10 Build info
----------
golang.org/x/tools/gopls v0.3.4
    golang.org/x/tools/gopls@v0.3.4 h1:4GC7q/pXQ/tsxHBGVdsMdlB4gCxVC06m/7rIXg1Px4E=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
    golang.org/x/mod@v0.1.1-0.20191105210325-c90efee705ee h1:WG0RUwxtNT4qqaXX3DPA8zHFNm/D9xaBpxzHt1WcA/E=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/tools@v0.0.0-20200316194252-fafb6e2e8a4a h1:hKrQy/q8/Xivoqgw6nGiz1jqpn1WGBLDcWLZwW0983E=
    golang.org/x/xerrors@v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
    honnef.co/go/tools@v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U=
    mvdan.cc/xurls/v2@v2.1.0 h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA=

Go info
-------
go version go1.14.1 windows/amd64

set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\MahaKaal\AppData\Local\go-build
set GOENV=C:\Users\MahaKaal\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=E:\Go_code
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\MahaKaal\AppData\Local\Temp\go-build701097334=/tmp/go-build -gno-record-gcc-switches
2020/03/31 13:05:11 Info:2020/03/31 13:05:11 go/packages.Load
        snapshot = 0
        query = [./ builtin]
        packages = 2
2020/03/31 13:05:11 Info:2020/03/31 13:05:11 go/packages.Load
        snapshot = 0
        query = [./]
        packages = 1

@stamblerre
Copy link
Contributor

It looks like you are working both outside of your GOPATH and outside of a module. Is this intentional?

@stamblerre stamblerre added the upstream-gopls Issue for gopls label Mar 31, 2020
@vikram-rawat
Copy link
Author

I am not working from outside GOPATH. This is a dummy code inside my src folder. My understanding is that everything inside src folder is supposed to work. I have been doing it for many projects before module came into picture. This code used to work just fine a few days ago. Let me know if I am missing a piece here. I would be happy to get it resolved by few tweeks.

I didn't have this issue before updating to go 1.4.1. It was working fine with 1.4.0.

It asked me to update gotools and since then I have this issue.

@stamblerre
Copy link
Contributor

Do you mean that the path to the file is something like $GOPATH/src/file.go? I'm not sure that we've ever considered such a case, or how it should be supported.

Can you please capture your gopls logs when you see this happening? https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md#capturing-logs

@vikram-rawat
Copy link
Author

I couldn't open localhost:6060 to capture this information.because gopls hangs my computer. I have removed it from my bin files. Than only I can work.

Now I can't take advantage of vscode features at least I can work. With gopls installed every time I hit save. My computer hangs and I have to reboot it.

@vikram-rawat
Copy link
Author

Is there a way I can go to the previous version of gopls. that worked for me. It was working fine before I upgraded golang to 1.14.1. I just need to start working on go projects and this is stopping me from using any feature vscode has for golang.

@hyangah
Copy link
Contributor

hyangah commented Apr 4, 2020

Before downgrading can you try the following command from the root of your workspace?

gopls -rpc.trace -v check /path/to/file.go

You can pick up the previous version of gopls by running
GO111MODULE=on go get golang.org/x/tools/gopls@<your desired version> from the terminal. You can control the installation path by using GOBIN env var, or directly overwriting the existing one with the newly built one.

Available versions are https://pkg.go.dev/golang.org/x/tools/gopls?tab=versions

If VS Code still responds, can you check the "View: Toggle Output" -> "gopls" channel from drop down menu (or Ctrl+K Ctrl+H)?

@stamblerre
Copy link
Contributor

+1 to all of @hyangah's suggestions above. FWIW, the save pop-ups are caused by a more recent version of VS Code, so I don't think that downgrading gopls will fix that problem.

However, if gopls completely doesn't work for you, we can try to figure out why. A good first step would be running the command that @hyangah mentioned.

@vikram-rawat
Copy link
Author

I updated the gopls to the latest version 0.4.0 but it still had the same problem. I had to restart my computer because everything got stuck. and I went to the src folder of my gopath. but

PS E:\Go_code\src> gopls -rpc.trace -v check main.go flag provided but not defined: -rpc The Go Language source tools.
this is the error I get flag provided but not defined

@vikram-rawat
Copy link
Author

Please fix it anyhow. It is stopping me from working on vscode at all. Because not working is something I can handle. But rebooting the entire Laptop again and again is not something I can do handle.

@stamblerre
Copy link
Contributor

Can you confirm the version of gopls you are using (gopls version)?
When you are working in VS Code, do you open the entirety of your $GOPATH/src?

Please take a look at the recent gopls release notes and golang/go#36899 to see if you can fit your workflow into one of the currently supported cases. If not, I'd suggest disabling gopls ("go.useLanguageServer": false), particularly since you aren't using modules. Alternatively, you can try downgrading to gopls/v0.2.2 or VS Code 1.42 and seeing if that fixes the problem.

@vikram-rawat
Copy link
Author

I updated gopls to version 0.4.0 and vscode version to1.44.0. Now it is better than before. but My computer still got stuck and I had to restart it. but since then go command has become slow for me as well. go run command takes like forever to compile.

I am again removing gopls so that I can work on projects. Please fix it ASAP. as it is hindering people like me to work properly.

@stamblerre
Copy link
Contributor

It's difficult for me to understand your issue without the answer to my question above:

When you are working in VS Code, do you open the entirety of your $GOPATH/src?

If so, it sounds like you're encountering the "At your own risk" case described under the GOPATH mode section in golang/go#36899, which I linked above. The work-around to it would be opening just the single Go file you are working on, which gopls does not yet support (golang/go#34160).

As I suggested above, disabling gopls is probably the correct choice, as it's not necessary to use gopls in GOPATH mode, and the default behavior of the Go extension should be sufficient.

@stamblerre
Copy link
Contributor

I'm trying to centralize the discussions about this bug into one issue, so I'm going to close this in favor of #3179.

@stamblerre
Copy link
Contributor

Duplicate of #3179

@stamblerre stamblerre marked this as a duplicate of #3179 Apr 15, 2020
@vscodebot vscodebot bot locked and limited conversation to collaborators May 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants