1
0
mirror of https://github.com/golang/go synced 2024-09-30 20:18:33 -06:00

internal/lsp: remove the redundant Server.Run() call.

`go s.Run(ctx)` repeats `h(s)`.

Change-Id: I03ae6df64ad34194b8f46aabd0cf67e5a9e8c777
GitHub-Last-Rev: 3669875d72a196a8c84fb1709a7cf9f84fdbb688
GitHub-Pull-Request: golang/tools#105
Reviewed-on: https://go-review.googlesource.com/c/tools/+/179297
Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
Henry Wong 2019-05-30 10:13:54 +00:00 committed by Ian Cottrell
parent 04b924abaa
commit bf5f34bf87
2 changed files with 3 additions and 6 deletions

View File

@ -81,7 +81,7 @@ func (s *Serve) Run(ctx context.Context, args ...string) error {
// For debugging purposes only.
run := func(srv *lsp.Server) {
srv.Conn.Logger = logger(s.Trace, out)
go srv.Conn.Run(ctx)
go srv.Run(ctx)
}
if s.Address != "" {
return lsp.RunServerOnAddress(ctx, s.app.cache, s.Address, run)
@ -92,7 +92,7 @@ func (s *Serve) Run(ctx context.Context, args ...string) error {
stream := jsonrpc2.NewHeaderStream(os.Stdin, os.Stdout)
srv := lsp.NewServer(s.app.cache, stream)
srv.Conn.Logger = logger(s.Trace, out)
return srv.Conn.Run(ctx)
return srv.Run(ctx)
}
func (s *Serve) forward() error {

View File

@ -53,10 +53,7 @@ func RunServerOnAddress(ctx context.Context, cache source.Cache, addr string, h
if err != nil {
return err
}
stream := jsonrpc2.NewHeaderStream(conn, conn)
s := NewServer(cache, stream)
h(s)
go s.Run(ctx)
h(NewServer(cache, jsonrpc2.NewHeaderStream(conn, conn)))
}
}