Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools / gopls@v0.5.2 / doc / troubleshooting.md
1 # Troubleshooting
2
3 If you suspect that `gopls` is crashing or not working correctly, please follow the [troubleshooting steps](#steps) below.
4
5 If `gopls` is using too much memory, please follow the steps under [Memory usage](#memory-usage).
6
7 ## Steps
8
9 <!--- TODO: troubleshooting
10 describe more basic and optional trouble shooting steps
11   like checking you opened the module root
12   and using the debug pages
13 --->
14
15 1. Make sure your `gopls` is [up to date](user.md#installing).
16 1. Check the [known issues](status.md#known-issues).
17 1. [Report the issue](#file-an-issue).
18
19 ## File an issue
20
21 You can use:
22
23 * Your editor's bug submission integration (if available). For instance, `:GoReportGitHubIssue` in [`vim-go`](vim.md#vim-go).
24 * `gopls bug` on the command line.
25 * The [Go issue tracker](https://github.com/golang/go/issues/new?title=x%2Ftools%2Fgopls%3A%20%3Cfill%20this%20in%3E).
26
27 Along with an explanation of the issue, please share the information listed here:
28
29 1. Your editor and any settings you have configured (for example, your VSCode `settings.json` file).
30 1. A sample program that reproduces the issue, if possible.
31 1. The output of `gopls version` on the command line.
32 1. The output of `gopls -rpc.trace -v check /path/to/file.go`.
33 1. gopls logs from when the issue occurred, as well as a timestamp for when the issue began to occur. See the [instructions](#capturing-gopls-logs) for information on how to capture gopls logs.
34
35 Much of this information is filled in for you if you use `gopls bug` to file the issue.
36
37 ### Capturing logs
38
39 #### VS Code
40
41 For VSCode users, the gopls log can be found by navigating to `View` -> `Output` (or `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 `gopls` logs.
42
43 To increase the level of detail in your logs, add the following to your VS Code settings:
44
45 ```json5
46 "go.languageServerFlags": [
47   "-rpc.trace"
48 ]
49 ```
50
51 To start a debug server that will allow you to see profiles and memory usage, add the following to your VS Code settings:
52
53 ```json5
54 "go.languageServerFlags": [
55   "serve",
56   "-rpc.trace",
57   "--debug=localhost:6060",
58 ],
59 ```
60
61 You will then be able to view debug information by navigating to `localhost:6060`.
62
63 #### Other editors
64
65 For other editors, you may have to directly pass a `-logfile` flag to gopls.
66
67 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`. You will then be able to view debug information by navigating to `localhost:6060`.
68
69 If you are unsure of how to pass a flag to `gopls` through your editor, please see the [documentation for your editor](user.md#editors).
70
71 ### Restart your editor
72
73 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"`.
74
75 ## Memory usage
76
77 `gopls` automatically writes out memory debug information when your usage
78 exceeds 1GB. This information can be found in your temporary directory with
79 names like `gopls.1234-5GiB-withnames.zip`. On Windows, your temporary
80 directory will be located at `%TMP%`, and on Unixes, it will be `$TMPDIR`,
81 which is usually `/tmp`. Please create a
82 [new issue](https://github.com/golang/go/issues/new?title=x%2Ftools%2Fgopls%3A%20%3Cfill%20this%20in%3E)
83 with your editor settings and memory debug information attached. If you are
84 uncomfortable sharing the package names of your code, you can share the
85 `-nonames` zip instead.