diff --git a/gopls/internal/hooks/hooks.go b/gopls/internal/hooks/hooks.go new file mode 100644 index 0000000000..1c133e837b --- /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 8f49ccc935..31d356ee13 100644 --- a/gopls/main.go +++ b/gopls/main.go @@ -12,10 +12,13 @@ import ( "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:]) }