I found a bit weird behavior in gopls
command, but I don’t know this is expected or not, so let me ask.
I executed gopls help
and got the following result:
gopls: Unknown command help
The Go Language source tools.
Usage: gopls [flags] <command> [command-flags] [command-args]
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. The language features can also be accessed via the gopls command-line interface.
Available commands are:
main:
serve : run a server for Go code using the Language Server Protocol
version : print the gopls version information
bug : report a bug in gopls
features:
check : show diagnostic results for the specified file
definition : show declaration of selected identifier
folding_ranges : display selected file's folding ranges
format : format the code according to the go standard
highlight : display selected identifier's highlights
implementation : display selected identifier's implementation
imports : updates import statements
inspect : inspect server state (daemon mode only)
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
signature : display selected identifier's signature
fix : apply suggested fixes
symbols : display selected file's symbols
workspace_symbol : search symbols in workspace
gopls flags are:
As you can see above, flags are missing at the end of help text.
On the other hand, I executed gopls --help
and got the following:
The Go Language source tools.
Usage: gopls [flags] <command> [command-flags] [command-args]
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. The language features can also be accessed via the gopls command-line interface.
Available commands are:
main:
serve : run a server for Go code using the Language Server Protocol
version : print the gopls version information
bug : report a bug in gopls
features:
check : show diagnostic results for the specified file
definition : show declaration of selected identifier
folding_ranges : display selected file's folding ranges
format : format the code according to the go standard
highlight : display selected identifier's highlights
implementation : display selected identifier's implementation
imports : updates import statements
inspect : inspect server state (daemon mode only)
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
signature : display selected identifier's signature
fix : apply suggested fixes
symbols : display selected file's symbols
workspace_symbol : search symbols in workspace
gopls flags are:
-debug string
serve debug information on the supplied address
-listen string
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.
-listen.timeout duration
when used with -listen, shut down the server when there are no connected clients for this duration
-logfile string
filename to log to. if value is "auto", then logging to a default output file is enabled
-mode string
no effect
-ocagent string
the address of the ocagent, or off (default "off")
-port int
port on which to run gopls for debugging purposes
-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.
-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 (default "auto")
-rpc.trace
print the full rpc trace in lsp inspector format
-v verbose output
Flags are listed properly at the end of help text.
Is this an expected behavior? Thanks for your help.
Build Info
I used the latest master branch at Mon Jun 15 12:45:09 UTC 2020.
~/projects/golang/tools/gopls
❯ ./gopls -v version
Build info
----------
golang.org/x/tools/gopls master
golang.org/x/tools/gopls@(devel)
github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
golang.org/x/mod@v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
golang.org/x/sync@v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
golang.org/x/tools@v0.0.0-20200515220128-d3bf790afa53 => ../
golang.org/x/xerrors@v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
honnef.co/go/tools@v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=
mvdan.cc/xurls/v2@v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=
Go info
-------
go version go1.14 darwin/amd64
~/projects/golang/tools/gopls
❯ git rev-parse HEAD
54c614fe050cac95ace393a63f164149942ecbde
~/projects/golang/tools/gopls
❯ git status
On branch master
Your branch is up to date with 'origin/master'