Skip to content

Commit

Permalink
Use Go stdlib context package instead of golang.org/x/net/context
Browse files Browse the repository at this point in the history
The context package was added in Go 1.7 [1]. The implementation in
x/net/context is merely a type alias now on newer Go versions, so use
context directly.

[1] https://golang.org/doc/go1.7#context

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
  • Loading branch information
tklauser committed Apr 28, 2020
1 parent 904cae6 commit 5e0ae19
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/client/client.go
Expand Up @@ -15,6 +15,7 @@
package client

import (
"context"
"fmt"
"io"
"net"
Expand All @@ -32,7 +33,6 @@ import (

runtime_client "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"golang.org/x/net/context"
)

type Client struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/client_test.go
Expand Up @@ -17,14 +17,14 @@
package client

import (
"context"
"errors"
"fmt"
"testing"
"time"

"github.com/cilium/cilium/api/v1/models"

"golang.org/x/net/context"
. "gopkg.in/check.v1"
)

Expand Down
7 changes: 3 additions & 4 deletions pkg/envoy/grpc.go
Expand Up @@ -25,7 +25,6 @@ import (

"github.com/cilium/proxy/go/cilium/api"
envoy_api_v2 "github.com/cilium/proxy/go/envoy/api/v2"
net_context "golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
)
Expand Down Expand Up @@ -86,7 +85,7 @@ func (s *xdsGRPCServer) StreamListeners(stream envoy_api_v2.ListenerDiscoverySer
return (*xds.Server)(s).HandleRequestStream(stream.Context(), stream, ListenerTypeURL)
}

func (s *xdsGRPCServer) FetchListeners(ctx net_context.Context, req *envoy_api_v2.DiscoveryRequest) (*envoy_api_v2.DiscoveryResponse, error) {
func (s *xdsGRPCServer) FetchListeners(ctx context.Context, req *envoy_api_v2.DiscoveryRequest) (*envoy_api_v2.DiscoveryResponse, error) {
// The Fetch methods are only called via the REST API, which is not
// implemented in Cilium. Only the Stream methods are called over gRPC.
return nil, ErrNotImplemented
Expand All @@ -96,7 +95,7 @@ func (s *xdsGRPCServer) StreamNetworkPolicies(stream cilium.NetworkPolicyDiscove
return (*xds.Server)(s).HandleRequestStream(stream.Context(), stream, NetworkPolicyTypeURL)
}

func (s *xdsGRPCServer) FetchNetworkPolicies(ctx net_context.Context, req *envoy_api_v2.DiscoveryRequest) (*envoy_api_v2.DiscoveryResponse, error) {
func (s *xdsGRPCServer) FetchNetworkPolicies(ctx context.Context, req *envoy_api_v2.DiscoveryRequest) (*envoy_api_v2.DiscoveryResponse, error) {
// The Fetch methods are only called via the REST API, which is not
// implemented in Cilium. Only the Stream methods are called over gRPC.
return nil, ErrNotImplemented
Expand All @@ -106,7 +105,7 @@ func (s *xdsGRPCServer) StreamNetworkPolicyHosts(stream cilium.NetworkPolicyHost
return (*xds.Server)(s).HandleRequestStream(stream.Context(), stream, NetworkPolicyHostsTypeURL)
}

func (s *xdsGRPCServer) FetchNetworkPolicyHosts(ctx net_context.Context, req *envoy_api_v2.DiscoveryRequest) (*envoy_api_v2.DiscoveryResponse, error) {
func (s *xdsGRPCServer) FetchNetworkPolicyHosts(ctx context.Context, req *envoy_api_v2.DiscoveryRequest) (*envoy_api_v2.DiscoveryResponse, error) {
// The Fetch methods are only called via the REST API, which is not
// implemented in Cilium. Only the Stream methods are called over gRPC.
return nil, ErrNotImplemented
Expand Down

0 comments on commit 5e0ae19

Please sign in to comment.