gopls: add a hooks package

This allows us to hook functionality from the main tools repository with
alternate or extended implementations.

Change-Id: Ibc66cdd15ee80f1104a8464f1e28763a41d5765a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196319
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/gopls/internal/hooks/hooks.go b/gopls/internal/hooks/hooks.go
new file mode 100644
index 0000000..1c133e8
--- /dev/null
+++ b/gopls/internal/hooks/hooks.go
@@ -0,0 +1,16 @@
+// Copyright 2019 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.
+
+// Package hooks adds all the standard gopls implementations.
+// This can be used in tests without needing to use the gopls main, and is
+// also the place to edit for custom builds of gopls.
+package hooks // import "golang.org/x/tools/gopls/internal/hooks"
+
+import (
+	"context"
+)
+
+func Install(ctx context.Context) context.Context {
+	return ctx
+}
diff --git a/gopls/main.go b/gopls/main.go
index 8f49ccc..31d356e 100644
--- a/gopls/main.go
+++ b/gopls/main.go
@@ -12,10 +12,13 @@
 	"context"
 	"os"
 
+	"golang.org/x/tools/gopls/internal/hooks"
 	"golang.org/x/tools/internal/lsp/cmd"
 	"golang.org/x/tools/internal/tool"
 )
 
 func main() {
-	tool.Main(context.Background(), cmd.New("gopls", "", nil), os.Args[1:])
+	ctx := context.Background()
+	ctx = hooks.Install(ctx)
+	tool.Main(ctx, cmd.New("gopls", "", nil), os.Args[1:])
 }