x/tools: modernize interface{} -> any
Produced with a patched version of modernize containing only the efaceany pass: $ go run ./gopls/internal/analysis/modernize/cmd/modernize/main.go -test -fix ./... ./gopls/... This is very safe and forms the bulk of the modernize diff, isolating the other changes for ease of review. Change-Id: Iec9352bac5a639a5c03368427531c7842c6e9ad0 Reviewed-on: https://go-review.googlesource.com/c/tools/+/650759 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
a462ac68ac
commit
47e1b0be9d
1 changed files with 46 additions and 46 deletions
|
|
@ -260,7 +260,7 @@ func newConnection(bindCtx context.Context, rwc io.ReadWriteCloser, binder Binde
|
|||
// Notify invokes the target method but does not wait for a response.
|
||||
// The params will be marshaled to JSON before sending over the wire, and will
|
||||
// be handed to the method invoked.
|
||||
func (c *Connection) Notify(ctx context.Context, method string, params interface{}) (err error) {
|
||||
func (c *Connection) Notify(ctx context.Context, method string, params any) (err error) {
|
||||
ctx, done := event.Start(ctx, method,
|
||||
jsonrpc2.Method.Of(method),
|
||||
jsonrpc2.RPCDirection.Of(jsonrpc2.Outbound),
|
||||
|
|
@ -309,7 +309,7 @@ func (c *Connection) Notify(ctx context.Context, method string, params interface
|
|||
// be handed to the method invoked.
|
||||
// You do not have to wait for the response, it can just be ignored if not needed.
|
||||
// If sending the call failed, the response will be ready and have the error in it.
|
||||
func (c *Connection) Call(ctx context.Context, method string, params interface{}) *AsyncCall {
|
||||
func (c *Connection) Call(ctx context.Context, method string, params any) *AsyncCall {
|
||||
// Generate a new request identifier.
|
||||
id := Int64ID(atomic.AddInt64(&c.seq, 1))
|
||||
ctx, endSpan := event.Start(ctx, method,
|
||||
|
|
@ -410,7 +410,7 @@ func (ac *AsyncCall) retire(response *Response) {
|
|||
|
||||
// Await waits for (and decodes) the results of a Call.
|
||||
// The response will be unmarshaled from JSON into the result.
|
||||
func (ac *AsyncCall) Await(ctx context.Context, result interface{}) error {
|
||||
func (ac *AsyncCall) Await(ctx context.Context, result any) error {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
|
|
@ -429,7 +429,7 @@ func (ac *AsyncCall) Await(ctx context.Context, result interface{}) error {
|
|||
//
|
||||
// Respond must be called exactly once for any message for which a handler
|
||||
// returns ErrAsyncResponse. It must not be called for any other message.
|
||||
func (c *Connection) Respond(id ID, result interface{}, err error) error {
|
||||
func (c *Connection) Respond(id ID, result any, err error) error {
|
||||
var req *incomingRequest
|
||||
c.updateInFlight(func(s *inFlightState) {
|
||||
req = s.incomingByID[id]
|
||||
|
|
@ -678,7 +678,7 @@ func (c *Connection) handleAsync() {
|
|||
}
|
||||
|
||||
// processResult processes the result of a request and, if appropriate, sends a response.
|
||||
func (c *Connection) processResult(from interface{}, req *incomingRequest, result interface{}, err error) error {
|
||||
func (c *Connection) processResult(from any, req *incomingRequest, result any, err error) error {
|
||||
switch err {
|
||||
case ErrAsyncResponse:
|
||||
if !req.IsCall() {
|
||||
|
|
@ -781,7 +781,7 @@ func (c *Connection) write(ctx context.Context, msg Message) error {
|
|||
// internalErrorf reports an internal error. By default it panics, but if
|
||||
// c.onInternalError is non-nil it instead calls that and returns an error
|
||||
// wrapping ErrInternal.
|
||||
func (c *Connection) internalErrorf(format string, args ...interface{}) error {
|
||||
func (c *Connection) internalErrorf(format string, args ...any) error {
|
||||
err := fmt.Errorf(format, args...)
|
||||
if c.onInternalError == nil {
|
||||
panic("jsonrpc2: " + err.Error())
|
||||
|
|
@ -803,7 +803,7 @@ func labelStatus(ctx context.Context, err error) {
|
|||
// notDone is a context.Context wrapper that returns a nil Done channel.
|
||||
type notDone struct{ ctx context.Context }
|
||||
|
||||
func (ic notDone) Value(key interface{}) interface{} {
|
||||
func (ic notDone) Value(key any) any {
|
||||
return ic.ctx.Value(key)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue