If you see a gopls error or crash, or gopls just stops working, please follow the troubleshooting steps below.
You can use:
gopls bug
on the command lineAlong with an explanation of the issue, please share the information listed here:
gopls version
on 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 to file the issue.
For VSCode users, the gopls log can be found by going to "View: Debug Console" -> "Output" -> "Tasks" -> "gopls"
. 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 gopls with serve --debug=localhost:6060
. See the editor configurations section below for information on how to pass these flags via 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"
.