| gopls is a Go language server. | |
| It is typically used with an editor to provide language features. When no | |
| command is specified, gopls will default to the 'serve' command. To see flags | |
| for the 'serve' command, run 'gopls help serve'. | |
| The language features can also be accessed via the gopls command-line interface. | |
| For documentation of all its features, see: | |
| https://go.dev/gopls/features | |
| Usage: | |
| gopls help [<subject>] | |
| Command: | |
| Main | |
| serve run a server for Go code using the Language Server Protocol | |
| version print the gopls version information | |
| help print usage information for subcommands | |
| api-json print JSON describing gopls API | |
| licenses print licenses of included software | |
| Features | |
| call_hierarchy display selected identifier's call hierarchy | |
| check show diagnostic results for the specified file | |
| codeaction list or execute code actions | |
| codelens List or execute code lenses for a file | |
| definition show declaration of selected identifier | |
| execute Execute a gopls custom LSP command | |
| folding_ranges display selected file's folding ranges | |
| format format the code according to the go standard | |
| mcp start the gopls MCP server in headless mode | |
| highlight display selected identifier's highlights | |
| implementation display selected identifier's implementation | |
| imports updates import statements | |
| inspect display the target's definition location, hover docs, and signature | |
| remote interact with the gopls daemon | |
| links list links in a file | |
| prepare_rename test validity of a rename operation at location | |
| references display selected identifier's references | |
| rename rename selected identifier | |
| semtok show semantic tokens for the specified file | |
| signature display selected identifier's signature | |
| stats print workspace statistics | |
| symbols display selected file's symbols | |
| workspace_symbol search symbols in workspace | |
| Internal Use Only | |
| vulncheck run vulncheck analysis (internal-use only) | |
| flags: | |
| -otel=string | |
| export telemetry to specified OpenTelemetry collector address (e.g. http://localhost:4318) | |
| -profile.alloc=string | |
| write alloc profile to this file | |
| -profile.block=string | |
| write block profile to this file | |
| -profile.cpu=string | |
| write CPU profile to this file | |
| -profile.mem=string | |
| write memory profile to this file | |
| -profile.trace=string | |
| write trace log to this file | |
| -remote=string | |
| 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, and the daemon is started if it is not already running. | |
| -remote.debug=string | |
| when used with -remote=auto, the -debug value used to start the daemon | |
| -remote.listen.timeout=duration | |
| when used with -remote=auto, the -listen.timeout value used to start the daemon (default 1m0s) | |
| -remote.logfile=string | |
| when used with -remote=auto, the -logfile value used to start the daemon | |
| -v,-verbose | |
| verbose output | |
| -vv,-veryverbose | |
| very verbose output | |
| For flags specific to running the language server (such as -listen, -logfile, or -debug), run 'gopls help serve'. |