Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: replace "x/net/context" import with "context" #2439

Merged
merged 2 commits into from
Nov 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1118,8 +1118,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 @@ -1164,7 +1164,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