cmd/gopls: rename "golsp" to "gopls", as in "Go Please"

Change-Id: Ie5688759ce21bffa6745eb86ef3606639e3ce335
Reviewed-on: https://go-review.googlesource.com/c/158197
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
diff --git a/cmd/golsp/main.go b/cmd/golsp/main.go
index 365ef14..c873daf 100644
--- a/cmd/golsp/main.go
+++ b/cmd/golsp/main.go
@@ -2,6 +2,11 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// -----------------------------------------------------------------
+// WARNING: golsp has been renamed to gopls (see cmd/gopls/main.go).
+// This file will be deleted soon.
+// -----------------------------------------------------------------
+
 // The golsp command is an LSP server for Go.
 // The Language Server Protocol allows any text editor
 // to be extended with IDE-like features;
diff --git a/cmd/golsp/forward/main.go b/cmd/gopls/forward/main.go
similarity index 94%
rename from cmd/golsp/forward/main.go
rename to cmd/gopls/forward/main.go
index 1139fe9..145bd46 100644
--- a/cmd/golsp/forward/main.go
+++ b/cmd/gopls/forward/main.go
@@ -1,4 +1,4 @@
-// The forward command writes and reads to a golsp server on a network socket.
+// The forward command writes and reads to a gopls server on a network socket.
 package main
 
 import (
diff --git a/cmd/golsp/integration/vscode/.vscode/launch.json b/cmd/gopls/integration/vscode/.vscode/launch.json
similarity index 100%
rename from cmd/golsp/integration/vscode/.vscode/launch.json
rename to cmd/gopls/integration/vscode/.vscode/launch.json
diff --git a/cmd/golsp/integration/vscode/.vscode/tasks.json b/cmd/gopls/integration/vscode/.vscode/tasks.json
similarity index 100%
rename from cmd/golsp/integration/vscode/.vscode/tasks.json
rename to cmd/gopls/integration/vscode/.vscode/tasks.json
diff --git a/cmd/golsp/integration/vscode/README.md b/cmd/gopls/integration/vscode/README.md
similarity index 82%
rename from cmd/golsp/integration/vscode/README.md
rename to cmd/gopls/integration/vscode/README.md
index e35bf8d..d3b7deb 100644
--- a/cmd/golsp/integration/vscode/README.md
+++ b/cmd/gopls/integration/vscode/README.md
@@ -1,7 +1,7 @@
-# golsp testing extension
+# gopls testing extension
 
 An extension for debugging the Go Language Server provided by 
-https://golang.org/x/tools/cmd/golsp. The code for this extension comes from
+https://golang.org/x/tools/cmd/gopls. The code for this extension comes from
 a combination of 
 https://github.com/Microsoft/vscode-extension-samples/blob/master/lsp-sample
 and https://github.com/Microsoft/vscode-go. 
@@ -18,4 +18,4 @@
 To package the extension, run `vsce package` from this directory. To install
 the extension, navigate to the "Extensions" panel in VSCode, and select
 "Install from VSIX..." from the menu in the top right corner. Choose the 
-`golsp-1.0.0.vsix file` and reload VSCode.
+`gopls-1.0.0.vsix file` and reload VSCode.
diff --git a/cmd/golsp/integration/vscode/package-lock.json b/cmd/gopls/integration/vscode/package-lock.json
similarity index 100%
rename from cmd/golsp/integration/vscode/package-lock.json
rename to cmd/gopls/integration/vscode/package-lock.json
diff --git a/cmd/golsp/integration/vscode/package.json b/cmd/gopls/integration/vscode/package.json
similarity index 82%
rename from cmd/golsp/integration/vscode/package.json
rename to cmd/gopls/integration/vscode/package.json
index 1665d5f..f533d5a 100644
--- a/cmd/golsp/integration/vscode/package.json
+++ b/cmd/gopls/integration/vscode/package.json
@@ -1,5 +1,5 @@
 {
-    "name": "golsp",
+    "name": "gopls",
     "description": "Go Language Server Client for testing",
     "author": "The Go authors",
     "license": "SEE LICENSE IN ../../../../LICENSE",
@@ -35,21 +35,21 @@
     },
     "contributes": {
         "configuration": {
-            "title": "Go LSP",
+            "title": "gopls",
             "properties": {
-                "golsp.flags": {
+                "gopls.flags": {
                     "type": "array",
                     "items": {
                         "type": "string"
                     },
                     "default": [],
-                    "description": "Flags to pass to golsp",
+                    "description": "Flags to pass to gopls",
                     "scope": "resource"
                 },
-                "golsp.command": {
+                "gopls.command": {
                     "type": "string",
-                    "default": "golsp",
-                    "description": "Name of the GoLSP binary",
+                    "default": "gopls",
+                    "description": "Name of the gopls binary",
                     "scope": "resource"
                 }
             }
diff --git a/cmd/golsp/integration/vscode/src/extension.ts b/cmd/gopls/integration/vscode/src/extension.ts
similarity index 87%
rename from cmd/golsp/integration/vscode/src/extension.ts
rename to cmd/gopls/integration/vscode/src/extension.ts
index 5725be6..4c03b73 100644
--- a/cmd/golsp/integration/vscode/src/extension.ts
+++ b/cmd/gopls/integration/vscode/src/extension.ts
@@ -11,11 +11,11 @@
 
 export function activate(ctx: vscode.ExtensionContext): void {
   let document = vscode.window.activeTextEditor.document;
-  let config = vscode.workspace.getConfiguration('golsp', document.uri);
-  let golspCommand: string = config['command'];
-  let golspFlags: string[] = config['flags'];
+  let config = vscode.workspace.getConfiguration('gopls', document.uri);
+  let goplsCommand: string = config['command'];
+  let goplsFlags: string[] = config['flags'];
   let serverOptions:
-      lsp.ServerOptions = {command: getBinPath(golspCommand), args: golspFlags};
+      lsp.ServerOptions = {command: getBinPath(goplsCommand), args: goplsFlags};
   let clientOptions: lsp.LanguageClientOptions = {
     initializationOptions: {},
     documentSelector: ['go'],
@@ -26,7 +26,7 @@
     },
     revealOutputChannelOn: lsp.RevealOutputChannelOn.Never,
   };
-  const c = new lsp.LanguageClient('golsp', serverOptions, clientOptions);
+  const c = new lsp.LanguageClient('gopls', serverOptions, clientOptions);
   c.onReady().then(() => {
     const capabilities = c.initializeResult && c.initializeResult.capabilities;
     if (!capabilities) {
diff --git a/cmd/golsp/integration/vscode/tsconfig.json b/cmd/gopls/integration/vscode/tsconfig.json
similarity index 100%
rename from cmd/golsp/integration/vscode/tsconfig.json
rename to cmd/gopls/integration/vscode/tsconfig.json
diff --git a/cmd/golsp/integration/vscode/tslint.json b/cmd/gopls/integration/vscode/tslint.json
similarity index 100%
rename from cmd/golsp/integration/vscode/tslint.json
rename to cmd/gopls/integration/vscode/tslint.json
diff --git a/cmd/gopls/main.go b/cmd/gopls/main.go
new file mode 100644
index 0000000..7b708ab
--- /dev/null
+++ b/cmd/gopls/main.go
@@ -0,0 +1,21 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// The gopls command is an LSP server for Go.
+// The Language Server Protocol allows any text editor
+// to be extended with IDE-like features;
+// see https://langserver.org/ for details.
+package main // import "golang.org/x/tools/cmd/gopls"
+
+import (
+	"context"
+	"os"
+
+	"golang.org/x/tools/internal/lsp/cmd"
+	"golang.org/x/tools/internal/tool"
+)
+
+func main() {
+	tool.Main(context.Background(), &cmd.Application{}, os.Args[1:])
+}
diff --git a/internal/lsp/cmd/cmd.go b/internal/lsp/cmd/cmd.go
index 2320838..9bf80dd 100644
--- a/internal/lsp/cmd/cmd.go
+++ b/internal/lsp/cmd/cmd.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// Package cmd handles the golsp command line.
+// Package cmd handles the gopls command line.
 // It contains a handler for each of the modes, along with all the flag handling
 // and the command line output format.
 package cmd
@@ -27,7 +27,7 @@
 }
 
 // Name implements tool.Application returning the binary name.
-func (app *Application) Name() string { return "golsp" }
+func (app *Application) Name() string { return "gopls" }
 
 // Usage implements tool.Application returning empty extra argument usage.
 func (app *Application) Usage() string { return "<mode> [mode-flags] [mode-args]" }
@@ -47,7 +47,7 @@
 		fmt.Fprintf(f.Output(), "  %s : %v\n", c.Name(), c.ShortHelp())
 	}
 	fmt.Fprint(f.Output(), `
-golsp flags are:
+gopls flags are:
 `)
 	f.PrintDefaults()
 }
@@ -71,7 +71,7 @@
 	return tool.CommandLineErrorf("Unknown mode %v", mode)
 }
 
-// modes returns the set of command modes supported by the golsp tool on the
+// modes returns the set of command modes supported by the gopls tool on the
 // command line.
 // The mode is specified by the first non flag argument.
 func (app *Application) modes() []tool.Application {
diff --git a/internal/lsp/cmd/server.go b/internal/lsp/cmd/server.go
index f6ab95a..dc9a2c4 100644
--- a/internal/lsp/cmd/server.go
+++ b/internal/lsp/cmd/server.go
@@ -26,7 +26,7 @@
 type Server struct {
 	Logfile string `flag:"logfile" help:"filename to log to. if value is \"auto\", then logging to a default output file is enabled"`
 	Mode    string `flag:"mode" help:"no effect"`
-	Port    int    `flag:"port" help:"port on which to run golsp for debugging purposes"`
+	Port    int    `flag:"port" help:"port on which to run gopls for debugging purposes"`
 }
 
 func (s *Server) Name() string  { return "server" }
@@ -51,7 +51,7 @@
 	if s.Logfile != "" {
 		filename := s.Logfile
 		if filename == "auto" {
-			filename = filepath.Join(os.TempDir(), fmt.Sprintf("golsp-%d.log", os.Getpid()))
+			filename = filepath.Join(os.TempDir(), fmt.Sprintf("gopls-%d.log", os.Getpid()))
 		}
 		f, err := os.Create(filename)
 		if err != nil {