internal/lsp/cmd: print flags when running gopls help

Currently, flags are not being printed when users run `gopls help` because they
never get parsed in Main. This CL fixes that issue.

Updates golang/go#35855

Change-Id: Ic9882d0d2410a0f045aa0ecaa87b36c23eb569fd
Reviewed-on: https://go-review.googlesource.com/c/tools/+/330854
Trust: Jean de Klerk <deklerk@google.com>
Run-TryBot: Jean de Klerk <deklerk@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Jean de Klerk 2021-06-25 08:55:41 -06:00
Родитель 640c1dea83
Коммит 77c1b7a4f7
1 изменённых файлов: 1 добавлений и 0 удалений

Просмотреть файл

@ -88,6 +88,7 @@ func Main(ctx context.Context, app Application, args []string) {
fmt.Fprintf(s.Output(), "\n\nUsage: %v [flags] %v\n", app.Name(), app.Usage())
app.DetailedHelp(s)
}
addFlags(s, reflect.StructField{}, reflect.ValueOf(app))
if err := Run(ctx, app, args); err != nil {
fmt.Fprintf(s.Output(), "%s: %v\n", app.Name(), err)
if _, printHelp := err.(commandLineError); printHelp {