aboutsummaryrefslogtreecommitdiff
path: root/internal/jsonrpc2
diff options
context:
space:
mode:
Diffstat (limited to 'internal/jsonrpc2')
-rw-r--r--internal/jsonrpc2/conn.go2
-rw-r--r--internal/jsonrpc2/messages.go3
-rw-r--r--internal/jsonrpc2/serve.go5
-rw-r--r--internal/jsonrpc2/servertest/servertest.go4
-rw-r--r--internal/jsonrpc2/servertest/servertest_test.go2
-rw-r--r--internal/jsonrpc2/wire.go2
6 files changed, 9 insertions, 9 deletions
diff --git a/internal/jsonrpc2/conn.go b/internal/jsonrpc2/conn.go
index ca7752d66..529cfa5de 100644
--- a/internal/jsonrpc2/conn.go
+++ b/internal/jsonrpc2/conn.go
@@ -13,7 +13,7 @@ import (
"golang.org/x/tools/internal/event"
"golang.org/x/tools/internal/event/label"
- "golang.org/x/tools/internal/lsp/debug/tag"
+ "golang.org/x/tools/internal/event/tag"
)
// Conn is the common interface to jsonrpc clients and servers.
diff --git a/internal/jsonrpc2/messages.go b/internal/jsonrpc2/messages.go
index c29a0e851..58d285d99 100644
--- a/internal/jsonrpc2/messages.go
+++ b/internal/jsonrpc2/messages.go
@@ -6,9 +6,8 @@ package jsonrpc2
import (
"encoding/json"
+ "errors"
"fmt"
-
- errors "golang.org/x/xerrors"
)
// Message is the interface to all jsonrpc2 message types.
diff --git a/internal/jsonrpc2/serve.go b/internal/jsonrpc2/serve.go
index d58797152..cfbcbcb02 100644
--- a/internal/jsonrpc2/serve.go
+++ b/internal/jsonrpc2/serve.go
@@ -6,13 +6,14 @@ package jsonrpc2
import (
"context"
+ "errors"
"io"
+ "math"
"net"
"os"
"time"
"golang.org/x/tools/internal/event"
- errors "golang.org/x/xerrors"
)
// NOTE: This file provides an experimental API for serving multiple remote
@@ -100,7 +101,7 @@ func Serve(ctx context.Context, ln net.Listener, server StreamServer, idleTimeou
}()
// Max duration: ~290 years; surely that's long enough.
- const forever = 1<<63 - 1
+ const forever = math.MaxInt64
if idleTimeout <= 0 {
idleTimeout = forever
}
diff --git a/internal/jsonrpc2/servertest/servertest.go b/internal/jsonrpc2/servertest/servertest.go
index 392e084a9..37f8475be 100644
--- a/internal/jsonrpc2/servertest/servertest.go
+++ b/internal/jsonrpc2/servertest/servertest.go
@@ -50,7 +50,7 @@ func NewTCPServer(ctx context.Context, server jsonrpc2.StreamServer, framer json
// Connect dials the test server and returns a jsonrpc2 Connection that is
// ready for use.
-func (s *TCPServer) Connect(ctx context.Context) jsonrpc2.Conn {
+func (s *TCPServer) Connect(_ context.Context) jsonrpc2.Conn {
netConn, err := net.Dial("tcp", s.Addr)
if err != nil {
panic(fmt.Sprintf("servertest: failed to connect to test instance: %v", err))
@@ -68,7 +68,7 @@ type PipeServer struct {
}
// NewPipeServer returns a test server that can be connected to via io.Pipes.
-func NewPipeServer(ctx context.Context, server jsonrpc2.StreamServer, framer jsonrpc2.Framer) *PipeServer {
+func NewPipeServer(server jsonrpc2.StreamServer, framer jsonrpc2.Framer) *PipeServer {
if framer == nil {
framer = jsonrpc2.NewRawStream
}
diff --git a/internal/jsonrpc2/servertest/servertest_test.go b/internal/jsonrpc2/servertest/servertest_test.go
index 38fa21a24..1780d4f91 100644
--- a/internal/jsonrpc2/servertest/servertest_test.go
+++ b/internal/jsonrpc2/servertest/servertest_test.go
@@ -26,7 +26,7 @@ func TestTestServer(t *testing.T) {
server := jsonrpc2.HandlerServer(fakeHandler)
tcpTS := NewTCPServer(ctx, server, nil)
defer tcpTS.Close()
- pipeTS := NewPipeServer(ctx, server, nil)
+ pipeTS := NewPipeServer(server, nil)
defer pipeTS.Close()
tests := []struct {
diff --git a/internal/jsonrpc2/wire.go b/internal/jsonrpc2/wire.go
index d805f5793..ac39f1601 100644
--- a/internal/jsonrpc2/wire.go
+++ b/internal/jsonrpc2/wire.go
@@ -33,7 +33,7 @@ var (
ErrServerOverloaded = NewError(-32000, "JSON RPC overloaded")
)
-// wireRequest is sent to a server to represent a Call or Notify operaton.
+// wireRequest is sent to a server to represent a Call or Notify operation.
type wireRequest struct {
// VersionTag is always encoded as the string "2.0"
VersionTag wireVersionTag `json:"jsonrpc"`