mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
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>
This commit is contained in:
parent
db1d4edb46
commit
c426260dee
16
gopls/internal/hooks/hooks.go
Normal file
16
gopls/internal/hooks/hooks.go
Normal file
@ -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
|
||||
}
|
@ -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:])
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user