| 1 |
|
| 2 |
gopls is a Go language server. |
| 3 |
|
| 4 |
It is typically used with an editor to provide language features. When no |
| 5 |
command is specified, gopls will default to the 'serve' command. The language |
| 6 |
features can also be accessed via the gopls command-line interface. |
| 7 |
|
| 8 |
For documentation of all its features, see: |
| 9 |
|
| 10 |
https://github.com/golang/tools/blob/master/gopls/doc/features |
| 11 |
|
| 12 |
Usage: |
| 13 |
gopls help [<subject>] |
| 14 |
|
| 15 |
Command: |
| 16 |
|
| 17 |
Main |
| 18 |
serve run a server for Go code using the Language Server Protocol |
| 19 |
version print the gopls version information |
| 20 |
help print usage information for subcommands |
| 21 |
api-json print JSON describing gopls API |
| 22 |
licenses print licenses of included software |
| 23 |
|
| 24 |
Features |
| 25 |
call_hierarchy display selected identifier's call hierarchy |
| 26 |
check show diagnostic results for the specified file |
| 27 |
codeaction list or execute code actions |
| 28 |
codelens List or execute code lenses for a file |
| 29 |
definition show declaration of selected identifier |
| 30 |
execute Execute a gopls custom LSP command |
| 31 |
fix apply suggested fixes (obsolete) |
| 32 |
folding_ranges display selected file's folding ranges |
| 33 |
format format the code according to the go standard |
| 34 |
mcp start the gopls MCP server in headless mode |
| 35 |
highlight display selected identifier's highlights |
| 36 |
implementation display selected identifier's implementation |
| 37 |
imports updates import statements |
| 38 |
remote interact with the gopls daemon |
| 39 |
inspect interact with the gopls daemon (deprecated: use 'remote') |
| 40 |
links list links in a file |
| 41 |
prepare_rename test validity of a rename operation at location |
| 42 |
references display selected identifier's references |
| 43 |
rename rename selected identifier |
| 44 |
semtok show semantic tokens for the specified file |
| 45 |
signature display selected identifier's signature |
| 46 |
stats print workspace statistics |
| 47 |
symbols display selected file's symbols |
| 48 |
workspace_symbol search symbols in workspace |
| 49 |
|
| 50 |
Internal Use Only |
| 51 |
vulncheck run vulncheck analysis (internal-use only) |
| 52 |
|
| 53 |
flags: |
| 54 |
-debug=string |
| 55 |
serve debug information on the supplied address |
| 56 |
-listen=string |
| 57 |
address on which to listen for remote connections. If prefixed by 'unix;', the subsequent address is assumed to be a unix domain socket. Otherwise, TCP is used. |
| 58 |
-listen.timeout=duration |
| 59 |
when used with -listen, shut down the server when there are no connected clients for this duration |
| 60 |
-logfile=string |
| 61 |
filename to log to. if value is "auto", then logging to a default output file is enabled |
| 62 |
-mcp.listen=string |
| 63 |
experimental: address on which to listen for model context protocol connections. If port is localhost:0, pick a random port in localhost instead. |
| 64 |
-mode=string |
| 65 |
no effect |
| 66 |
-otel=string |
| 67 |
export telemetry to specified OpenTelemetry collector address (e.g. http://localhost:4318) |
| 68 |
-profile.alloc=string |
| 69 |
write alloc profile to this file |
| 70 |
-profile.block=string |
| 71 |
write block profile to this file |
| 72 |
-profile.cpu=string |
| 73 |
write CPU profile to this file |
| 74 |
-profile.mem=string |
| 75 |
write memory profile to this file |
| 76 |
-profile.trace=string |
| 77 |
write trace log to this file |
| 78 |
-remote=string |
| 79 |
forward all commands to a remote lsp specified by this flag. With no special prefix, this is assumed to be a TCP address. If prefixed by 'unix;', the subsequent address is assumed to be a unix domain socket. If 'auto', or prefixed by 'auto;', the remote address is automatically resolved based on the executing environment. |
| 80 |
-remote.debug=string |
| 81 |
when used with -remote=auto, the -debug value used to start the daemon |
| 82 |
-remote.listen.timeout=duration |
| 83 |
when used with -remote=auto, the -listen.timeout value used to start the daemon (default 1m0s) |
| 84 |
-remote.logfile=string |
| 85 |
when used with -remote=auto, the -logfile value used to start the daemon |
| 86 |
-rpc.trace |
| 87 |
print the full rpc trace in lsp inspector format |
| 88 |
-v,-verbose |
| 89 |
verbose output |
| 90 |
-vv,-veryverbose |
| 91 |
very verbose output |