Skip to content
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

Doing anything takes forever or is impossible #3649

Open
TheOnlyWei opened this issue Jan 4, 2025 · 11 comments
Open

Doing anything takes forever or is impossible #3649

TheOnlyWei opened this issue Jan 4, 2025 · 11 comments
Labels
WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@TheOnlyWei
Copy link

TheOnlyWei commented Jan 4, 2025

What version of Go, VS Code & VS Code Go extension are you using?

1.23.0 1.96.2 0.44.0
  • Run go version to get version of Go from the VS Code integrated terminal.
    • go version go1.23.0 windows/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • golang.org/x/tools/gopls v0.16.2
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.96.2
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.44.0
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
# Tools Configuration


## Environment

GOBIN: undefined
toolsGopath: 
gopath: C:\Users\test\go
GOROOT: C:\Program Files\Go
PATH: C:\Program Files\Eclipse Adoptium\jdk-21.0.3.9-hotspot\bin;C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\ProgramData\chocolatey\bin;C:\Program Files\Go\bin;C:\Program Files\PowerShell\7\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\Docker\Docker\resources\bin;C:\Users\test\AppData\Local\Programs\Python\Python311\Scripts\;C:\Users\test\AppData\Local\Programs\Python\Python311\;C:\Users\test\AppData\Local\Microsoft\WindowsApps;C:\Users\test\AppData\Local\Programs\Microsoft VS Code\bin;C:\agents-manager;C:\Users\test\go\bin;C:\nuget;C:\Program Files\Git\mingw64\bin;C:\Users\test\.azure\kubectl-client;C:\Users\test\.azure-kubelogin;C:\Program Files\Task\task_windows_amd64;C:\Users\test\AppData\Roaming\npm;C:\Users\test\.dotnet\tools;C:\azwi\azwi-v1.3.0-windows-amd64;C:\kubectl-tools;C:\Users\test\.krew\bin;C:\Users\test\go\bin;C:\Users\test\AppData\Local\Microsoft\WindowsApps;

## Tools

	go:	C:\Program Files\Go\bin\go.exe: go version go1.23.0 windows/amd64

	gopls:	C:\Users\test\go\bin\gopls.exe	(version: v0.17.1 built with go: go1.23.4)
	gotests:	C:\Users\test\go\bin\gotests.exe	(version: v1.6.0 built with go: go1.23.0)
	gomodifytags:	not installed
	impl:	not installed
	goplay:	not installed
	dlv:	C:\Users\test\go\bin\dlv.exe	(version: v1.24.0 built with go: go1.23.0)
	staticcheck:	C:\Users\test\go\bin\staticcheck.exe	(version: v0.5.1 built with go: go1.23.0)

## Go env

Workspace Folder (myrepo): c:\repos\myproject\myrepo

	set GO111MODULE=
	set GOARCH=amd64
	set GOBIN=
	set GOCACHE=C:\Users\test\AppData\Local\go-build
	set GOENV=C:\Users\test\AppData\Roaming\go\env
	set GOEXE=.exe
	set GOEXPERIMENT=
	set GOFLAGS=
	set GOHOSTARCH=amd64
	set GOHOSTOS=windows
	set GOINSECURE=
	set GOMODCACHE=C:\Users\test\go\pkg\mod
	set GONOPROXY=
	set GONOSUMDB=
	set GOOS=windows
	set GOPATH=C:\Users\test\go
	set GOPRIVATE=
	set GOPROXY=https://proxy.golang.org,direct
	set GOROOT=C:\Program Files\Go
	set GOSUMDB=sum.golang.org
	set GOTMPDIR=
	set GOTOOLCHAIN=auto
	set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
	set GOVCS=
	set GOVERSION=go1.23.0
	set GODEBUG=
	set GOTELEMETRY=local
	set GOTELEMETRYDIR=C:\Users\test\AppData\Roaming\go\telemetry
	set GCCGO=gccgo
	set GOAMD64=v1
	set AR=ar
	set CC=gcc
	set CXX=g++
	set CGO_ENABLED=0
	set GOMOD=c:\repos\myproject\myrepo\go.mod
	set GOWORK=
	set CGO_CFLAGS=-O2 -g
	set CGO_CPPFLAGS=
	set CGO_CXXFLAGS=-O2 -g
	set CGO_FFLAGS=-O2 -g
	set CGO_LDFLAGS=-O2 -g
	set PKG_CONFIG=pkg-config
	set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\test\AppData\Local\Temp\go-build3413711034=/tmp/go-build -gno-record-gcc-switches

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.

    "go.toolsManagement.autoUpdate": true,
    "go.languageServerFlags": [

        "-rpc.trace"
    ],
    "gopls": {
        "verboseOutput": true
    }

Describe the bug

Doing anything with the extension hangs on any of these messages:

Getting code actions from 'Go' ([configure](command:workbench.action.openSettings?%5B%22editor.codeActionsOnSave%22%5D)).
Saving 'bicep.go': Running Code Actions and Formatters...
Setting up workspace: Loading packages...

Currently, it is impossible to develop in VS Code with Go extension that it's better to just uninstall the VS Code Go extension just so I can save. (In the past, I used to get a merge conflict when saving files if you edit between when it is trying to save and before it is actually saved, but don't remember how to reproduce it and the behavior might have changed in newer versions.)

I expect to be able to save my .go files. There has been a bunch of these issues in the issues history, none of them have any proper resolution.

Steps to reproduce the behavior:

  1. Install VS Code Go extension.
  2. Edit a .go file.
  3. Try to save the .go file.
  4. Right click a random function and click Go to Defintion.
  5. Go extension tries to do a bunch of things that never ends up being done and file is never saved.

Screenshots or recordings

cannot-save-go-file1
cannot-save-go-file2

@gopherbot gopherbot added this to the Untriaged milestone Jan 4, 2025
@TheOnlyWei TheOnlyWei changed the title Saving a file takes forever or is impossible Doing anything takes forever or is impossible Jan 4, 2025
@stevehipwell
Copy link

@TheOnlyWei I was seeing issues like this with Go in VS Code with the Go Companion extension (also tracked in this repo) installed but they stopped when I disabled it.

@hyangah
Copy link
Contributor

hyangah commented Jan 6, 2025

@TheOnlyWei Thanks for the report.

We need more info for triage since the repro step included in this report alone doesn't seem to reproduce the issue. Can you please follow the instruction here (https://github.com/golang/vscode-go/wiki/troubleshooting#collect-extension-logs) and
share the log? (We want to understand why "loading workspace" couldn't complete so we need log messages around workspace loading)

Otherwise, there is a merge conflict when saving files if you edit between when it is trying to save and before it is actually saved.

Do you mean there were merge conflicts before saving files, or you ended up facing merge conflicts due to slow saving??

Not an ideal solution, but you can try to disable the auto-import/formatting on save while we are investigating.

      "[go]": {
        "editor.formatOnSave": false,
        "editor.codeActionsOnSave": {
          "source.organizeImports": "never"
        }
      }

@stevehipwell your issue may be different since the original report uses VS Code Go v0.44.0 with which Go companion extension isn't supposed to get activated. If you encountered the issue please report the problem in a separate issue so we can track it down. Thanks.

@stevehipwell
Copy link

@hyangah I was using the Go 0.44.0 extension and the Go Companion 0.0.5 extension and AFAIK both were active.

@firelizzard18
Copy link
Contributor

@TheOnlyWei Do you have Go Companion installed?

@stevehipwell With Go 0.44.0 and Go Companion 0.0.5 installed, I'd expect you to end up with two separate copies of the test item tree in VSCode's testing panel. Go Companion's presence should not have an effect on normal (non-prerelease) versions of the Go extension.

I was seeing issues like this with Go in VS Code with the Go Companion extension (also tracked in this repo) installed but they stopped when I disabled it.

Does "when I disabled it" refer to Go Companion, Go, or both? If disabling Go Companion makes the Go extension work, my guess is it has something to do with gopls, such as a crash in the test discovery code. @hyangah @findleyr does that seem plausible? Besides gopls the interaction between the two extensions is very limited.

@hyangah Go Companion's activation isn't conditional, though maybe it should be.

@stevehipwell
Copy link

@firelizzard18 "when I disabled it" refers to Go Companion. I have the companion for the test explorer improvements, but if it's no longer required I can leave it disabled?

@firelizzard18
Copy link
Contributor

firelizzard18 commented Jan 6, 2025

@stevehipwell Test explorer improvements/features are being worked on in Go Companion so it's still required from that perspective. Prerelease versions of the Go extension will automatically disable the old test explorer and code lens implementation, but you're running a release version of the Go extension; if you want to avoid seeing both, you need to disable the old implementation via settings or switch to a prerelease version of the Go extension.

@hyangah
Copy link
Contributor

hyangah commented Jan 6, 2025

@firelizzard18 v0.44.0 is the non-prerelease, latest version of the Go extension. Having two testing panels aren't nice (even though I don't know why users would end up with Go Companion and Go 0.44.0) and suppressing the Go companion would be nice.

Looks like the gopls didn't crash (if we believe the status bar in the screenshot), but seeing the trace will help us investigate.

@firelizzard18
Copy link
Contributor

@TheOnlyWei Can you please share the log you see in the gopls output channel when this issue is occurring?
Screen Shot 2021-01-27 at 2 53 49 PM

@firelizzard18 firelizzard18 added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jan 6, 2025
@stevehipwell
Copy link

@firelizzard18 @hyangah I followed some advice to add the Go companion, but AFAIk it didn't specify using a pre-release version of the Go extension? This was all working correctly a few weeks ago.

@firelizzard18
Copy link
Contributor

@stevehipwell I started a separate discussion because I don't want to derail this issue.

@TheOnlyWei
Copy link
Author

TheOnlyWei commented Jan 6, 2025

@hyangah There is nothing in the Tasks output.
tasks-output

By merge conflict, I mean when I save the files while the Go extension is hanging on doing stuff, it is preventing VS code from saving and would eventually detect a merge conflict with the file and pop up a split window asking you to keep one version versus some other version. However, this happened maybe several months ago, not sure if it is still an issue. Maybe the behavior changed, but I don't remember how to repro the merge conflict.

@firelizzard18 I don't have Go Companion installed.

gopls (server) output log:
gopls_server.txt

Extension Host
extension_host.txt

Developer Tools
developer_tools.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants