If you suspect that
gopls is crashing or not working correctly, please follow the troubleshooting steps below.
gopls is using too much memory, please follow the steps under Memory usage.
You can use:
gopls bugon the command line.
Along with an explanation of the issue, please share the information listed here:
gopls versionon the command line.
gopls -rpc.trace -v check /path/to/file.go.
Much of this information is filled in for you if you use
gopls bug to file the issue.
For VSCode users, the gopls log can be found by navigating to
Ctrl+K Ctrl+H). There will be a drop-down menu titled
Tasks in the top-right corner. Select the
gopls (server) item, which will contain the
To increase the level of detail in your logs, add the following to your VS Code settings:
"go.languageServerFlags": [ "-rpc.trace" ]
To start a debug server that will allow you to see profiles and memory usage, add the following to your VS Code settings:
"go.languageServerFlags": [ "serve", "-rpc.trace", "--debug=localhost:6060", ],
You will then be able to view debug information by navigating to
For other editors, you may have to directly pass a
-logfile flag to gopls.
To increase the level of detail in your logs, start
gopls with the
-rpc.trace flag. To start a debug server that will allow you to see profiles and memory usage, start
serve --debug=localhost:6060. You will then be able to view debug information by navigating to
If you are unsure of how to pass a flag to
gopls through your editor, please see the documentation for your editor.
Once you have filed an issue, you can then try to restart your
gopls instance by restarting your editor. In many cases, this will correct the problem. In VSCode, the easiest way to restart the language server is by opening the command palette (Ctrl + Shift + P) and selecting
"Go: Restart Language Server". You can also reload the VSCode instance by selecting
"Developer: Reload Window".
gopls automatically writes out memory debug information when your usage exceeds 1GB. This information can be found in your temporary directory with names like
gopls.1234-5GiB-withnames.zip. On Windows, your temporary directory will be located at
%TMP%, and on Unixes, it will be
$TMPDIR, which is usually
/tmp. Please create a new issue with your editor settings and memory debug information attached. If you are uncomfortable sharing the package names of your code, you can share the
-nonames zip instead.