Skip to content

Commit

Permalink
cleanup: replace "x/net/context" import with "context" (#2439)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfawley authored Nov 12, 2018
1 parent eb55fa5 commit 04ea820
Show file tree
Hide file tree
Showing 91 changed files with 97 additions and 118 deletions.
2 changes: 1 addition & 1 deletion balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
package grpc

import (
"context"
"net"
"sync"

"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/grpclog"
Expand Down
2 changes: 1 addition & 1 deletion balancer/balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
package balancer

import (
"context"
"errors"
"net"
"strings"

"golang.org/x/net/context"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/metadata"
Expand Down
3 changes: 2 additions & 1 deletion balancer/base/balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
package base

import (
"golang.org/x/net/context"
"context"

"google.golang.org/grpc/balancer"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/grpclog"
Expand Down
2 changes: 1 addition & 1 deletion balancer/grpclb/grpclb.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
package grpclb

import (
"context"
"errors"
"strconv"
"strings"
"sync"
"time"

durationpb "github.com/golang/protobuf/ptypes/duration"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/balancer"
lbpb "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1"
Expand Down
2 changes: 1 addition & 1 deletion balancer/grpclb/grpclb_picker.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
package grpclb

import (
"context"
"sync"
"sync/atomic"

"golang.org/x/net/context"
"google.golang.org/grpc/balancer"
lbpb "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1"
"google.golang.org/grpc/codes"
Expand Down
2 changes: 1 addition & 1 deletion balancer/grpclb/grpclb_remote_balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
package grpclb

import (
"context"
"fmt"
"io"
"net"
"reflect"
"time"

timestamppb "github.com/golang/protobuf/ptypes/timestamp"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/balancer"
lbpb "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1"
Expand Down
2 changes: 1 addition & 1 deletion balancer/grpclb/grpclb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package grpclb

import (
"context"
"errors"
"fmt"
"io"
Expand All @@ -31,7 +32,6 @@ import (
"time"

durationpb "github.com/golang/protobuf/ptypes/duration"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/balancer"
lbgrpc "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1"
Expand Down
2 changes: 1 addition & 1 deletion balancer/roundrobin/roundrobin.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
package roundrobin

import (
"context"
"sync"

"golang.org/x/net/context"
"google.golang.org/grpc/balancer"
"google.golang.org/grpc/balancer/base"
"google.golang.org/grpc/grpclog"
Expand Down
2 changes: 1 addition & 1 deletion balancer/roundrobin/roundrobin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
package roundrobin_test

import (
"context"
"fmt"
"net"
"sync"
"testing"
"time"

"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/balancer/roundrobin"
"google.golang.org/grpc/codes"
Expand Down
2 changes: 1 addition & 1 deletion balancer_switching_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
package grpc

import (
"context"
"fmt"
"math"
"testing"
"time"

"golang.org/x/net/context"
"google.golang.org/grpc/balancer"
"google.golang.org/grpc/balancer/roundrobin"
"google.golang.org/grpc/connectivity"
Expand Down
2 changes: 1 addition & 1 deletion balancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
package grpc

import (
"context"
"fmt"
"math"
"strconv"
"sync"
"testing"
"time"

"golang.org/x/net/context"
"google.golang.org/grpc/codes"
_ "google.golang.org/grpc/grpclog/glogger"
"google.golang.org/grpc/internal/leakcheck"
Expand Down
2 changes: 1 addition & 1 deletion balancer_v1_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
package grpc

import (
"context"
"strings"
"sync"

"golang.org/x/net/context"
"google.golang.org/grpc/balancer"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/connectivity"
Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Assume there are two result files names as "basePerf" and "curPerf" created by a
package main

import (
"context"
"encoding/gob"
"errors"
"flag"
Expand All @@ -59,7 +60,6 @@ import (
"testing"
"time"

"golang.org/x/net/context"
"google.golang.org/grpc"
bm "google.golang.org/grpc/benchmark"
testpb "google.golang.org/grpc/benchmark/grpc_testing"
Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ Package benchmark implements the building blocks to setup end-to-end gRPC benchm
package benchmark

import (
"context"
"fmt"
"io"
"net"
"sync"
"testing"
"time"

"golang.org/x/net/context"
"google.golang.org/grpc"
testpb "google.golang.org/grpc/benchmark/grpc_testing"
"google.golang.org/grpc/benchmark/latency"
Expand Down
2 changes: 1 addition & 1 deletion benchmark/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package main

import (
"context"
"flag"
"fmt"
"os"
Expand All @@ -27,7 +28,6 @@ import (
"sync"
"time"

"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/benchmark"
testpb "google.golang.org/grpc/benchmark/grpc_testing"
Expand Down
3 changes: 1 addition & 2 deletions benchmark/latency/latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ package latency

import (
"bytes"
"context"
"encoding/binary"
"fmt"
"io"
"net"
"time"

"golang.org/x/net/context"
)

// Dialer is a function matching the signature of net.Dial.
Expand Down
3 changes: 1 addition & 2 deletions benchmark/primitives/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
package primitives_test

import (
"context"
"testing"
"time"

"golang.org/x/net/context"
)

func BenchmarkCancelContextErrNoErr(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/worker/benchmark_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
package main

import (
"context"
"flag"
"math"
"runtime"
"sync"
"time"

"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/benchmark"
testpb "google.golang.org/grpc/benchmark/grpc_testing"
Expand Down
2 changes: 1 addition & 1 deletion benchmark/worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package main

import (
"context"
"flag"
"fmt"
"io"
Expand All @@ -29,7 +30,6 @@ import (
"strconv"
"time"

"golang.org/x/net/context"
"google.golang.org/grpc"
testpb "google.golang.org/grpc/benchmark/grpc_testing"
"google.golang.org/grpc/codes"
Expand Down
2 changes: 1 addition & 1 deletion call.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package grpc

import (
"golang.org/x/net/context"
"context"
)

// Invoke sends the RPC request on the wire and returns after response is
Expand Down
2 changes: 1 addition & 1 deletion call_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package grpc

import (
"context"
"fmt"
"io"
"math"
Expand All @@ -29,7 +30,6 @@ import (
"testing"
"time"

"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/internal/leakcheck"
"google.golang.org/grpc/internal/transport"
Expand Down
2 changes: 1 addition & 1 deletion channelz/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
package service

import (
"context"
"net"
"time"

"github.com/golang/protobuf/ptypes"
durpb "github.com/golang/protobuf/ptypes/duration"
wrpb "github.com/golang/protobuf/ptypes/wrappers"
"golang.org/x/net/context"
"google.golang.org/grpc"
channelzgrpc "google.golang.org/grpc/channelz/grpc_channelz_v1"
channelzpb "google.golang.org/grpc/channelz/grpc_channelz_v1"
Expand Down
2 changes: 1 addition & 1 deletion channelz/service/service_sktopt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
package service

import (
"context"
"reflect"
"strconv"
"testing"

"github.com/golang/protobuf/ptypes"
durpb "github.com/golang/protobuf/ptypes/duration"
"golang.org/x/net/context"
"golang.org/x/sys/unix"
channelzpb "google.golang.org/grpc/channelz/grpc_channelz_v1"
"google.golang.org/grpc/internal/channelz"
Expand Down
2 changes: 1 addition & 1 deletion channelz/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package service

import (
"context"
"fmt"
"net"
"reflect"
Expand All @@ -28,7 +29,6 @@ import (

"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes"
"golang.org/x/net/context"
channelzpb "google.golang.org/grpc/channelz/grpc_channelz_v1"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/credentials"
Expand Down
3 changes: 1 addition & 2 deletions clientconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -1137,8 +1137,8 @@ func (ac *addrConn) createTransport(backoffNum int, addr resolver.Address, copts
ac.mu.Unlock()
}

// Do not cancel in the success path because of this issue in Go1.6: https://github.com/golang/go/issues/15078.
connectCtx, cancel := context.WithDeadline(ac.ctx, connectDeadline)
defer cancel()
if channelz.IsOn() {
copts.ChannelzParentID = ac.channelzID
}
Expand Down Expand Up @@ -1183,7 +1183,6 @@ func (ac *addrConn) createTransport(backoffNum int, addr resolver.Address, copts

if err != nil {
// newTr is either nil, or closed.
cancel()
ac.cc.blockingpicker.updateConnectionError(err)
ac.mu.Lock()
if ac.state == connectivity.Shutdown {
Expand Down
2 changes: 1 addition & 1 deletion clientconn_state_transition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
package grpc

import (
"context"
"net"
"sync"
"sync/atomic"
"testing"
"time"

"golang.org/x/net/context"
"golang.org/x/net/http2"
"google.golang.org/grpc/balancer"
"google.golang.org/grpc/connectivity"
Expand Down
2 changes: 1 addition & 1 deletion clientconn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package grpc

import (
"context"
"errors"
"fmt"
"math"
Expand All @@ -27,7 +28,6 @@ import (
"testing"
"time"

"golang.org/x/net/context"
"golang.org/x/net/http2"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/credentials"
Expand Down
3 changes: 2 additions & 1 deletion connectivity/connectivity.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
package connectivity

import (
"golang.org/x/net/context"
"context"

"google.golang.org/grpc/grpclog"
)

Expand Down
Loading

0 comments on commit 04ea820

Please sign in to comment.