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

saving file stuck: Saving 'xxxx.go': Getting code actions from ''Go'' #2687

Closed
mingqishao opened this issue Mar 1, 2023 · 32 comments
Closed
Labels
WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@mingqishao
Copy link

mingqishao commented Mar 1, 2023

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

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
    • go version go1.18.9 darwin/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
Build info
----------
golang.org/x/tools/gopls v0.11.0
    golang.org/x/tools/[email protected] h1:/nvKHdTtePQmrv9XN3gIUN9MOdUrKzO/dcqgbG6x8EY=
    github.com/BurntSushi/[email protected] h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
    github.com/google/[email protected] h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
    github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/[email protected] h1:QfTh0HpN6hlw6D3vu8DAwC8pBIwikq0AI1evdm+FksE=
    golang.org/x/exp/[email protected] h1:fl8k2zg28yA23264d82M4dp+YlJ3ngDcpuB1bewkQi4=
    golang.org/x/[email protected] h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
    golang.org/x/[email protected] h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
    golang.org/x/[email protected] h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
    golang.org/x/[email protected] h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
    golang.org/x/[email protected] h1:7/HkGkN/2ktghBCSRRgp31wAww4syfsW52tj7yirjWk=
    golang.org/x/[email protected] h1:qptQiQwEpETwDiz85LKtChqif9xhVkAm8Nhxs0xnTww=
    honnef.co/go/[email protected] h1:oDx7VAwstgpYpb3wv0oxiZlxY+foCpRAwY7Vk6XpAgA=
    mvdan.cc/[email protected] h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
    mvdan.cc/xurls/[email protected] h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: go1.19.4
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
~$ code -v
1.75.1
441438abd1ac652551dbe4d408dfcec8a499b8bf
x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.38.0
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
Checking configured tools....
GOBIN: undefined
toolsGopath: 
gopath: /Users/minsha/go
GOROOT: /usr/local/Cellar/[email protected]/1.18.9/libexec
PATH: /usr/local/opt/[email protected]/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Users/minsha/go/bin

	go:	/usr/local/opt/[email protected]/bin/go: go version go1.18.9 darwin/amd64

	gotests:	/Users/minsha/go/bin/gotests	(version: v1.6.0 built with go: go1.19.4)
	gomodifytags:	/Users/minsha/go/bin/gomodifytags	(version: v1.16.0 built with go: go1.19.4)
	impl:	/Users/minsha/go/bin/impl	(version: v1.1.0 built with go: go1.19.4)
	goplay:	/Users/minsha/go/bin/goplay	(version: v1.0.0 built with go: go1.19.4)
	dlv:	/Users/minsha/go/bin/dlv	(version: v1.20.1 built with go: go1.19.4)
	staticcheck:	/Users/minsha/go/bin/staticcheck	(version: v0.3.3 built with go: go1.19.4)
	gopls:	/Users/minsha/go/bin/gopls	(version: v0.11.0 built with go: go1.19.4)

go env
Workspace Folder (e2e): /Users/minsha/codes/aks-rp/test/e2e
	GO111MODULE=""
	GOARCH="amd64"
	GOBIN=""
	GOCACHE="/Users/minsha/Library/Caches/go-build"
	GOENV="/Users/minsha/Library/Application Support/go/env"
	GOEXE=""
	GOEXPERIMENT=""
	GOFLAGS=""
	GOHOSTARCH="amd64"
	GOHOSTOS="darwin"
	GOINSECURE=""
	GOMODCACHE="/Users/minsha/go/pkg/mod"
	GONOPROXY="none"
	GONOSUMDB="goms.io/aks/*,go.goms.io/aks/*,go.goms.io/caravel,go.goms.io/fleet"
	GOOS="darwin"
	GOPATH="/Users/minsha/go"
	GOPRIVATE="goms.io/aks/*,go.goms.io/aks/*,go.goms.io/caravel,go.goms.io/fleet"
	GOPROXY="..."
	GOROOT="/usr/local/Cellar/[email protected]/1.18.9/libexec"
	GOSUMDB="sum.golang.org"
	GOTMPDIR=""
	GOTOOLDIR="/usr/local/Cellar/[email protected]/1.18.9/libexec/pkg/tool/darwin_amd64"
	GOVCS=""
	GOVERSION="go1.18.9"
	GCCGO="gccgo"
	GOAMD64="v1"
	AR="ar"
	CC="clang"
	CXX="clang++"
	CGO_ENABLED="1"
	GOMOD="/Users/minsha/codes/aks-rp/test/e2e/go.mod"
	GOWORK=""
	CGO_CFLAGS="-g -O2"
	CGO_CPPFLAGS=""
	CGO_CXXFLAGS="-g -O2"
	CGO_FFLAGS="-g -O2"
	CGO_LDFLAGS="-g -O2"
	PKG_CONFIG="pkg-config"
	GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/xh/01ht2kqx3rd5whwp990kksfw0000gn/T/go-build1131890319=/tmp/go-build -gno-record-gcc-switches -fno-common"

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.

	// Feature level setting to enable/disable code lens for references and run/debug tests
	"go.enableCodeLens": {
		"runtest": true
	},

	// Flags to pass to format tool (e.g. ["-s"]). Not applicable when using the language server.
	"go.formatFlags": [],

	// When the language server is enabled and one of `default`/`gofmt`/`goimports`/`gofumpt` is chosen, the language server will handle formatting. If `custom` tool is selected, the extension will use the `customFormatter` tool in the `go.alternateTools` section.
	//  - default: If the language server is enabled, format via the language server, which already supports gofmt, goimports, goreturns, and gofumpt. Otherwise, goimports.
	//  - gofmt: Formats the file according to the standard Go style. (not applicable when the language server is enabled)
	//  - goimports: Organizes imports and formats the file with gofmt. (not applicable when the language server is enabled)
	//  - goformat: Configurable gofmt, see https://github.com/mbenkmann/goformat.
	//  - gofumpt: Stricter version of gofmt, see https://github.com/mvdan/gofumpt. . Use `gopls.format.gofumpt` instead)
	//  - custom: Formats using the custom tool specified as `customFormatter` in the `go.alternateTools` setting. The tool should take the input as STDIN and output the formatted code as STDOUT.
	"go.formatTool": "default",

	// Additional command line flags to pass to `gotests` for generating tests.
	"go.generateTestsFlags": [],

	// Enable gocode's autobuild feature. Not applicable when using the language server.
	"go.gocodeAutoBuild": false,

	// Additional flags to pass to gocode. Not applicable when using the language server.
	"go.gocodeFlags": [
		"-builtin",
		"-ignore-case",
		"-unimported-packages"
	],

	// Used to determine the Go package lookup rules for completions by gocode. Only applies when using nsf/gocode. Latest versions of the Go extension uses mdempsky/gocode by default. Not applicable when using the language server.
	"go.gocodePackageLookupMode": "go",

	// Specify GOPATH here to override the one that is set as environment variable. The inferred GOPATH from workspace root overrides this, if go.inferGopath is set to true.
	"go.gopath": null,

	// Specifies the GOROOT to use when no environment variable is set.
	"go.goroot": null,

	// Folder names (not paths) to ignore while using Go to Symbol in Workspace feature. Not applicable when using the language server.
	"go.gotoSymbol.ignoreFolders": [],

	// If false, the standard library located at $GOROOT will be excluded while using the Go to Symbol in File feature. Not applicable when using the language server.
	"go.gotoSymbol.includeGoroot": false,

	// If false, the import statements will be excluded while using the Go to Symbol in File feature. Not applicable when using the language server.
	"go.gotoSymbol.includeImports": false,

	// Infer GOPATH from the workspace root. This is ignored when using Go Modules.
	"go.inferGopath": false,

	// Enable/disable inlay hints for variable types in assign statements:
	// ```go
	// 	i/* int*/, j/* int*/ := 0, len(r)-1
	// ```
	"go.inlayHints.assignVariableTypes": false,

	// Enable/disable inlay hints for composite literal field names:
	// ```go
	// 	{/*in: */"Hello, world", /*want: */"dlrow ,olleH"}
	// ```
	"go.inlayHints.compositeLiteralFields": false,

	// Enable/disable inlay hints for composite literal types:
	// ```go
	// 	for _, c := range []struct {
	// 		in, want string
	// 	}{
	// 		/*struct{ in string; want string }*/{"Hello, world", "dlrow ,olleH"},
	// 	}
	// ```
	"go.inlayHints.compositeLiteralTypes": false,

	// Enable/disable inlay hints for constant values:
	// ```go
	// 	const (
	// 		KindNone   Kind = iota/* = 0*/
	// 		KindPrint/*  = 1*/
	// 		KindPrintf/* = 2*/
	// 		KindErrorf/* = 3*/
	// 	)
	// ```
	"go.inlayHints.constantValues": false,

	// Enable/disable inlay hints for implicit type parameters on generic functions:
	// ```go
	// 	myFoo/*[int, string]*/(1, "hello")
	// ```
	"go.inlayHints.functionTypeParameters": false,

	// Enable/disable inlay hints for parameter names:
	// ```go
	// 	parseInt(/* str: */ "123", /* radix: */ 8)
	// ```
	"go.inlayHints.parameterNames": false,

	// Enable/disable inlay hints for variable types in range statements:
	// ```go
	// 	for k/* int*/, v/* string*/ := range []string{} {
	// 		fmt.Println(k, v)
	// 	}
	// ```
	"go.inlayHints.rangeVariableTypes": false,

	// If true, then `-i` flag will be passed to `go build` everytime the code is compiled. Since Go 1.10, setting this may be unnecessary unless you are in GOPATH mode and do not use the language server.
	"go.installDependenciesWhenBuilding": false,

	// Temporary flag to enable/disable diagnostics from the language server. This setting will be deprecated soon. Please see and response to [Issue 50](https://github.com/golang/vscode-go/issues/50).
	"go.languageServerExperimentalFeatures": {
		"diagnostics": true
	},

	// Flags like -rpc.trace and -logfile to be used while running the language server.
	"go.languageServerFlags": [],

	// Flags to pass to Lint tool (e.g. ["-min_confidence=.8"])
	"go.lintFlags": [],

	// Lints code on file save using the configured Lint tool. Options are 'file', 'package', 'workspace' or 'off'.
	//  - file: lint the current file on file saving
	//  - package: lint the current package on file saving
	//  - workspace: lint all the packages in the current workspace root folder on file saving
	//  - off: do not run lint automatically
	"go.lintOnSave": "package",

	// Specifies Lint tool name.
	"go.lintTool": "staticcheck",

	// Use gotype on the file currently being edited and report any semantic or syntactic errors found after configured delay. Not applicable when using the language server.
	"go.liveErrors": {
		"enabled": false,
		"delay": 500
	},

	// The logging level the extension logs at, defaults to 'error'
	"go.logging.level": "error",

	// The flags configured here will be passed through to command `goplay`
	"go.playground": {
		"openbrowser": true,
		"share": true,
		"run": true
	},

	// Tags and options configured here will be used by the Remove Tags command to remove tags to struct fields. If promptForTags is true, then user will be prompted for tags and options. By default, all tags and options will be removed.
	"go.removeTags": {
		"tags": "",
		"options": "",
		"promptForTags": false
	},

	// Prompt for surveys, including the gopls survey and the Go developer survey.
	"go.survey.prompt": true,

	// enable the default go build/test task provider.
	"go.tasks.provideDefault": true,

	// Apply the Go & PATH environment variables used by the extension to all integrated terminals.
	"go.terminal.activateEnvironment": true,

	// Absolute path to a file containing environment variables definitions. File contents should be of the form key=value.
	"go.testEnvFile": null,

	// Environment variables that will be passed to the process that runs the Go tests
	"go.testEnvVars": {},

	// Run benchmarks when running all tests in a file or folder.
	"go.testExplorer.alwaysRunBenchmarks": false,

	// Concatenate all test log messages for a given location into a single message.
	"go.testExplorer.concatenateMessages": true,

	// Enable the Go test explorer
	"go.testExplorer.enable": true,

	// Present packages in the test explorer flat or nested.
	"go.testExplorer.packageDisplayMode": "flat",

	// Set the source location of dynamically discovered subtests to the location of the containing function. As a result, dynamically discovered subtests will be added to the gutter test widget of the containing function.
	"go.testExplorer.showDynamicSubtestsInEditor": false,

	// Open the test output terminal when a test run is started.
	"go.testExplorer.showOutput": true,

	// Flags to pass to `go test`. If null, then buildFlags will be used. This is not propagated to the language server.
	"go.testFlags": null,

	// Run 'go test' on save for current package. It is not advised to set this to `true` when you have Auto Save enabled.
	"go.testOnSave": false,

	// The Go build tags to use for when running tests. If null, then buildTags will be used.
	"go.testTags": null,

	// Specifies the timeout for go test in ParseDuration format.
	"go.testTimeout": "30s",

	// Environment variables that will be passed to the tools that run the Go tools (e.g. CGO_CFLAGS) and debuggee process launched by Delve. Format as string key:value pairs. When debugging, merged with `envFile` and `env` values with precedence `env` > `envFile` > `go.toolsEnvVars`.
	"go.toolsEnvVars": {},

	// Location to install the Go tools that the extension depends on if you don't want them in your GOPATH.
	"go.toolsGopath": null,

	// Automatically update the tools used by the extension, without prompting the user.
	"go.toolsManagement.autoUpdate": false,

	// Specify whether to prompt about new versions of Go and the Go tools (currently, only `gopls`) the extension depends on
	//  - proxy: keeps notified of new releases by checking the Go module proxy (GOPROXY)
	//  - local: checks only the minimum tools versions required by the extension
	//  - off: completely disables version check (not recommended)
	"go.toolsManagement.checkForUpdates": "proxy",

	// The path to the `go` binary used to install the Go tools. If it's empty, the same `go` binary chosen for the project will be used for tool installation.
	"go.toolsManagement.go": "",

	// Trace the communication between VS Code and the Go language server.
	"go.trace.server": "off",

	// Complete functions with their parameter signature, including the variable type. Not propagated to the language server.
	"go.useCodeSnippetsOnFunctionSuggest": false,

	// Complete functions with their parameter signature, excluding the variable types. Use `gopls.usePlaceholders` when using the language server.
	"go.useCodeSnippetsOnFunctionSuggestWithoutType": false,

	// Use `go.toolsManagement.checkForUpdates` instead.
	// When enabled, the extension automatically checks the Go proxy if there are updates available for Go and the Go tools (at present, only gopls) it depends on and prompts the user accordingly
	"go.useGoProxyToCheckForToolUpdates": true,

	// Use the Go language server "gopls" from Google for powering language features like code navigation, completion, refactoring, formatting & diagnostics.
	"go.useLanguageServer": true,

	// Flags to pass to `go tool vet` (e.g. ["-all", "-shadow"])
	"go.vetFlags": [],

	// Vets code on file save using 'go tool vet'. Not applicable when using the language server's diagnostics. See 'go.languageServerExperimentalFeatures.diagnostics' setting.
	//  - package: vet the current package on file saving
	//  - workspace: vet all the packages in the current workspace root folder on file saving
	//  - off: do not run vet automatically
	"go.vetOnSave": "package",

	// Configure the default Go language server ('gopls'). In most cases, configuring this section is unnecessary. See [the documentation](https://github.com/golang/tools/blob/master/gopls/doc/settings.md) for all available settings.
	"gopls": {},

Describe the bug

This happen sometime. When I save the "xx.go" file, VSCode is stuck in "Saving 'xxxx.go': Getting code actions from ''Go''". Then the file will be saved after 60 second timeout.

I expected it save file fast instead of waiting for 60 seconds.

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. See error

Screenshots or recordings

If applicable, add screenshots or recordings to help explain your problem.

@gopherbot gopherbot added this to the Untriaged milestone Mar 1, 2023
@mingqishao
Copy link
Author

image

@findleyr
Copy link
Member

findleyr commented Mar 2, 2023

We're working on a major redesign of gopls' internals that may improve this for you.

However, would you be able to collect logs, so that we can see what's going on?
https://github.com/golang/vscode-go/blob/master/docs/troubleshooting.md#collect-gopls-information

@mingqishao
Copy link
Author

I opened the gopls verbose log. Attchmentment is the log file after I change the file "aks-rp/fleet/pkg/log/log.go". This time the file was saved after 10 ~ 20 seconds.

gopls.log

@findleyr
Copy link
Member

findleyr commented Mar 2, 2023

I see in the log that the initial workspace load ~68s, after which point things look pretty fast. Did you change the file shortly after opening your session?

@hyangah hyangah added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Mar 7, 2023
@mingqishao
Copy link
Author

I see in the log that the initial workspace load ~68s, after which point things look pretty fast. Did you change the file shortly after opening your session?

No, I didn't change the file after saving and waiting the save finish.

@vogtb
Copy link

vogtb commented Apr 5, 2023

I'm experiencing this issue as well. The logs don't seem to show anything. I open VS code, edit one file, hit save, and watch as it hangs while "Getting code actions from "Go". Activity monitor says gopls is using 100% CPU.

Screenshot 2023-04-05 at 9 56 52 AM

@findleyr
Copy link
Member

findleyr commented Apr 5, 2023

Hi @vogtb: is that all you see in your logs?

Can you please try starting gopls with -rpc.trace, so that we can see which RPCs are stuck?

EDIT: fixed a typo: the flag is -rpc.trace.

@vogtb
Copy link

vogtb commented Apr 5, 2023

Yeah, that's all the log says. I'll turn on tracing, but I'm not sure how much use it'll be since the gopls proc seems to be the one hanging. Will update again when I've got some logs to show.

@vogtb
Copy link

vogtb commented Apr 6, 2023

Trace logs don't show much. Just not getting any response from gopls. Just making changes, moving around in a document, and I'm getting no response back so vscode is just canceling the requests.

Sample of the logs:

[Trace - 10:22:44.760 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"uri":"file:///Users/bvogt/dev/src/ben/gshr/config.go","version":42},"contentChanges":[{"range":{"start":{"line":59,"character":0},"end":{"line":59,"character":23}},"rangeLength":23,"text":""}]}


[Trace - 10:22:44.761 AM] Sending notification '$/cancelRequest'.
Params: {"id":243}


[Trace - 10:22:44.761 AM] Sending notification '$/cancelRequest'.
Params: {"id":236}


[Trace - 10:22:44.961 AM] Sending request 'textDocument/foldingRange - (244)'.
Params: {"textDocument":{"uri":"file:///Users/bvogt/dev/src/ben/gshr/config.go"}}


[Trace - 10:22:45.011 AM] Sending notification '$/cancelRequest'.
Params: {"id":237}


[Trace - 10:22:45.012 AM] Sending request 'textDocument/codeLens - (245)'.
Params: {"textDocument":{"uri":"file:///Users/bvogt/dev/src/ben/gshr/config.go"}}


[Trace - 10:22:45.165 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"uri":"file:///Users/bvogt/dev/src/ben/gshr/config.go","version":43},"contentChanges":[{"range":{"start":{"line":58,"character":16},"end":{"line":59,"character":0}},"rangeLength":1,"text":""}]}


[Trace - 10:22:45.166 AM] Sending notification '$/cancelRequest'.
Params: {"id":244}


[Trace - 10:22:45.367 AM] Sending request 'textDocument/foldingRange - (246)'.
Params: {"textDocument":{"uri":"file:///Users/bvogt/dev/src/ben/gshr/config.go"}}


[Trace - 10:22:45.421 AM] Sending notification '$/cancelRequest'.
Params: {"id":245}


[Trace - 10:22:45.421 AM] Sending request 'textDocument/codeLens - (247)'.
Params: {"textDocument":{"uri":"file:///Users/bvogt/dev/src/ben/gshr/config.go"}}


[Trace - 10:22:45.421 AM] Sending request 'textDocument/codeAction - (248)'.
Params: {"textDocument":{"uri":"file:///Users/bvogt/dev/src/ben/gshr/config.go"},"range":{"start":{"line":58,"character":16},"end":{"line":58,"character":16}},"context":{"diagnostics":[],"triggerKind":2}}


[Trace - 10:22:46.080 AM] Sending request 'textDocument/hover - (249)'.
Params: {"textDocument":{"uri":"file:///Users/bvogt/dev/src/ben/gshr/config.go"},"position":{"line":57,"character":11}}


[Trace - 10:22:46.166 AM] Sending request 'textDocument/documentLink - (250)'.
Params: {"textDocument":{"uri":"file:///Users/bvogt/dev/src/ben/gshr/config.go"}}


[Trace - 10:22:46.196 AM] Sending notification '$/cancelRequest'.
Params: {"id":249}


[Trace - 10:22:46.212 AM] Sending notification '$/cancelRequest'.
Params: {"id":167}


[Trace - 10:22:46.213 AM] Sending request 'textDocument/definition - (251)'.
Params: {"textDocument":{"uri":"file:///Users/bvogt/dev/src/ben/gshr/config.go"},"position":{"line":58,"character":15}}


[Trace - 10:22:46.330 AM] Sending request 'textDocument/codeAction - (252)'.
Params: {"textDocument":{"uri":"file:///Users/bvogt/dev/src/ben/gshr/config.go"},"range":{"start":{"line":0,"character":0},"end":{"line":60,"character":0}},"context":{"diagnostics":[],"only":["source.organizeImports"],"triggerKind":2}}


[Trace - 10:22:46.880 AM] Sending request 'textDocument/hover - (253)'.
Params: {"textDocument":{"uri":"file:///Users/bvogt/dev/src/ben/gshr/config.go"},"position":{"line":57,"character":9}}


[Trace - 10:22:47.148 AM] Sending notification '$/cancelRequest'.
Params: {"id":253}


[Trace - 10:22:47.430 AM] Sending request 'textDocument/hover - (254)'.
Params: {"textDocument":{"uri":"file:///Users/bvogt/dev/src/ben/gshr/config.go"},"position":{"line":53,"character":22}}


[Trace - 10:22:48.713 AM] Sending notification '$/cancelRequest'.
Params: {"id":254}


[Trace - 10:22:51.403 AM] Sending notification '$/cancelRequest'.
Params: {"id":161}


[Trace - 10:22:51.404 AM] Sending request 'textDocument/documentSymbol - (255)'.
Params: {"textDocument":{"uri":"file:///Users/bvogt/dev/src/ben/gshr/config.go"}}


[Trace - 10:23:25.587 AM] Sending notification '$/cancelRequest'.
Params: {"id":247}


[Trace - 10:23:25.587 AM] Sending request 'textDocument/codeLens - (256)'.
Params: {"textDocument":{"uri":"file:///Users/bvogt/dev/src/ben/gshr/config.go"}}


[Trace - 10:23:25.587 AM] Sending request 'textDocument/codeAction - (257)'.
Params: {"textDocument":{"uri":"file:///Users/bvogt/dev/src/ben/gshr/config.go"},"range":{"start":{"line":42,"character":17},"end":{"line":42,"character":17}},"context":{"diagnostics":[],"triggerKind":2}}


[Trace - 10:23:25.587 AM] Sending notification '$/cancelRequest'.
Params: {"id":248}

@vogtb
Copy link

vogtb commented Apr 7, 2023

I wrote about this in #2727.

Seems like I wasn't excluding some of my target directories in the build.directoryFilters setting, causing gopls to include them and hang. @mingqishao maybe this could be related?

@keegangclarke
Copy link

I have the same issue as @mingqishao but I noticed that windows defender's antivirus service hogs all my cpu resources at the same time. I suspect it could be related

@linlih
Copy link

linlih commented Jun 7, 2023

same issue here, wired stuff, and without solution

@findleyr
Copy link
Member

findleyr commented Jun 7, 2023

@linlih which version of gopls are you using?

If you are on [email protected] or earlier, and on Mac, we fixed a major bug causing these symptoms in [email protected].

@linlih
Copy link

linlih commented Jun 7, 2023

@findleyr I tried newest version and v0.9.4 still has this problem, i running this on linux server, and connect it through remote ssh.
I did not find any error message, so i can not find which part causing this problem.
Thx for the reply.

@findleyr
Copy link
Member

@linlih sorry for the slow response. Which version did you try? We believe this bug was fixed in [email protected].

Can you try go install golang.org/x/tools/gopls@latest?

@linlih
Copy link

linlih commented Jun 27, 2023

@linlih sorry for the slow response. Which version did you try? We believe this bug was fixed in [email protected].

Can you try go install golang.org/x/tools/gopls@latest?

Seems fixed. Thx !

@jamalc jamalc closed this as not planned Won't fix, can't repro, duplicate, stale Jul 20, 2023
@RajMohanJayakumar
Copy link

This issue is because of the VS Code which is trying to set up your project but it couldn't find go.mod file.

Do go mod init my-project

This fixes the issue

@gameliee
Copy link

gameliee commented Oct 1, 2024

I have the same issue. Tried to install latest version of gopls. go.mod file existed. Do anyone know how to fix?

image

@kstoykov
Copy link

kstoykov commented Oct 4, 2024

I have the same issue. It is outrageous. 2024 and saving a files taking.... AGES :(

@findleyr
Copy link
Member

findleyr commented Oct 4, 2024

@gameliee it looks like the extension is waiting for both "Go" and "GitHub Copilot Chat". I wonder if this could be Copilot taking a while?

@kstoykov we believe that this issue was fixed a while ago. If you're still experiencing it, could you help us investigate, starting with the output of gopls -v version?

@kstoykov
Copy link

kstoykov commented Oct 4, 2024

@findleyr I found a solution. Having * anywhere in GOPRIVATE made the things extremely slow. I removed the "*" solved the issue.

@findleyr
Copy link
Member

findleyr commented Oct 4, 2024

@kstoykov thank you, that is useful information.

@firelizzard18
Copy link
Contributor

@kstoykov Did you mean having * in GOPRIVATE? It looks like that's what you meant but GitHub's formatting changed it to italics.

@kstoykov
Copy link

kstoykov commented Oct 5, 2024

@findleyr Yes, I meant *. Didn't notice that it was changes to italic. I updated my initial comment.

@Tiper-In-Github
Copy link

  • gopls -v version

I tried to update it, but it was still the old version after the update. I had shut down the running gopls :

C:\Users\Admin>go install golang.org/x/tools/gopls@latest

C:\Users\Admin>gopls -v version
Build info
----------
golang.org/x/tools/gopls v0.16.2
    golang.org/x/tools/[email protected] h1:K1z03MlikHfaMTtG01cUeL5FAOTJnITuNe0TWOcg8tM=
    github.com/BurntSushi/[email protected] h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
    github.com/google/[email protected] h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
    golang.org/x/exp/[email protected] h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
    golang.org/x/[email protected] h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
    golang.org/x/[email protected] h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
    golang.org/x/[email protected] h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
    golang.org/x/[email protected] h1:Wm3cG5X6sZ0RSVRc/H1/sciC4AT6HAKgLCSH2lbpR/c=
    golang.org/x/[email protected] h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
    golang.org/x/[email protected] h1:6bJEg2w2kUHWlfdJaESYsmNfI1LKAZQi6zCa7LUn7eI=
    golang.org/x/[email protected] h1:SP0mPeg2PmGCu03V+61EcQiOjmpri2XijexKdzv8Z1I=
    honnef.co/go/[email protected] h1:9MDAWxMoSnB6QoSqiVr7P5mtkT9pOc1kSxchzPCnqJs=
    mvdan.cc/[email protected] h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo=
    mvdan.cc/xurls/[email protected] h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=
go: go1.22.5

@TheOnlyWei
Copy link

TheOnlyWei commented Jan 4, 2025

Still getting this issue, why was this closed? Makes Go development a nightmare because it takes 1+ minute to save a single file and could end up with some cache conflict if you try to edit any files before waiting for it to save, which forces you to use the confusing VS code interface for merge-conflict resolution.

@meowrain
Copy link

meowrain commented Jan 7, 2025

Still getting this issue, why was this closed? Makes Go development a nightmare because it takes 1+ minute to save a single file and could end up with some cache conflict if you try to edit any files before waiting for it to save, which forces you to use the confusing VS code interface for merge-conflict resolution.

It seems that this problem only happened on Windows,i didn't got this problem on my Linux PC.

@Schachte
Copy link

Schachte commented Jan 8, 2025

Affecting me on M1 Mac as well. Literally unusable experience

@findleyr
Copy link
Member

findleyr commented Jan 8, 2025

@TheOnlyWei has provided some debugging information in #3649, and we'll investigate.

@Schachte is this a recent regression for you, or your initial experience with the extension?

Clearly there's a bug here, but I want to understand if it is related to the environment, or a recent regression.

@themaxgoldman
Copy link

Also seeing this on an M2 Mac.

@findleyr
Copy link
Member

@themaxgoldman can you please also provide more information? Is this a recent regression? Can you try downgrading gopls to v0.16.2?

Does this occur in a small workspace? Do you have any other diagnostics or messages in your session?

@KevinVison
Copy link

any update, same issue in macos M2

Image

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