Skip to content

Commit

Permalink
Merge pull request go-kit#421 from go-kit/stdlib-context
Browse files Browse the repository at this point in the history
Use stdlib context instead of golang.org/x/net/context
  • Loading branch information
peterbourgon authored Feb 4, 2017
2 parents db87ca8 + 434ab6c commit 4366e8c
Show file tree
Hide file tree
Showing 30 changed files with 40 additions and 45 deletions.
2 changes: 1 addition & 1 deletion addsvc/cmd/addcli/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"context"
"flag"
"fmt"
"os"
Expand All @@ -12,7 +13,6 @@ import (
"github.com/lightstep/lightstep-tracer-go"
stdopentracing "github.com/opentracing/opentracing-go"
zipkin "github.com/openzipkin/zipkin-go-opentracing"
"golang.org/x/net/context"
"google.golang.org/grpc"
"sourcegraph.com/sourcegraph/appdash"
appdashot "sourcegraph.com/sourcegraph/appdash/opentracing"
Expand Down
2 changes: 1 addition & 1 deletion addsvc/cmd/addsvc/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"context"
"flag"
"fmt"
"net"
Expand All @@ -16,7 +17,6 @@ import (
stdopentracing "github.com/opentracing/opentracing-go"
zipkin "github.com/openzipkin/zipkin-go-opentracing"
stdprometheus "github.com/prometheus/client_golang/prometheus"
"golang.org/x/net/context"
"google.golang.org/grpc"
"sourcegraph.com/sourcegraph/appdash"
appdashot "sourcegraph.com/sourcegraph/appdash/opentracing"
Expand Down
3 changes: 1 addition & 2 deletions addsvc/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ package addsvc
// formats. It also includes endpoint middlewares.

import (
"context"
"fmt"
"time"

"golang.org/x/net/context"

"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/metrics"
Expand Down
3 changes: 1 addition & 2 deletions addsvc/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ package addsvc
// implementation. It also includes service middlewares.

import (
"context"
"errors"
"time"

"golang.org/x/net/context"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/metrics"
)
Expand Down
8 changes: 5 additions & 3 deletions addsvc/transport_grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package addsvc
// It utilizes the transport/grpc.Server.

import (
"context"

stdopentracing "github.com/opentracing/opentracing-go"
"golang.org/x/net/context"
oldcontext "golang.org/x/net/context"

"github.com/go-kit/kit/examples/addsvc/pb"
"github.com/go-kit/kit/log"
Expand Down Expand Up @@ -41,15 +43,15 @@ type grpcServer struct {
concat grpctransport.Handler
}

func (s *grpcServer) Sum(ctx context.Context, req *pb.SumRequest) (*pb.SumReply, error) {
func (s *grpcServer) Sum(ctx oldcontext.Context, req *pb.SumRequest) (*pb.SumReply, error) {
_, rep, err := s.sum.ServeGRPC(ctx, req)
if err != nil {
return nil, err
}
return rep.(*pb.SumReply), nil
}

func (s *grpcServer) Concat(ctx context.Context, req *pb.ConcatRequest) (*pb.ConcatReply, error) {
func (s *grpcServer) Concat(ctx oldcontext.Context, req *pb.ConcatRequest) (*pb.ConcatReply, error) {
_, rep, err := s.concat.ServeGRPC(ctx, req)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion addsvc/transport_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ package addsvc

import (
"bytes"
"context"
"encoding/json"
"errors"
"io/ioutil"
"net/http"

stdopentracing "github.com/opentracing/opentracing-go"
"golang.org/x/net/context"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/tracing/opentracing"
Expand Down
2 changes: 1 addition & 1 deletion addsvc/transport_thrift.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package addsvc
// yet. See https://github.com/go-kit/kit/issues/184.

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

"github.com/go-kit/kit/endpoint"
thriftadd "github.com/go-kit/kit/examples/addsvc/thrift/gen-go/addsvc"
Expand Down
2 changes: 1 addition & 1 deletion apigateway/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"bytes"
"context"
"encoding/json"
"flag"
"fmt"
Expand All @@ -18,7 +19,6 @@ import (
"github.com/gorilla/mux"
"github.com/hashicorp/consul/api"
stdopentracing "github.com/opentracing/opentracing-go"
"golang.org/x/net/context"

"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/examples/addsvc"
Expand Down
3 changes: 1 addition & 2 deletions profilesvc/cmd/profilesvc/main.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package main

import (
"context"
"flag"
"fmt"
"net/http"
"os"
"os/signal"
"syscall"

"golang.org/x/net/context"

"github.com/go-kit/kit/examples/profilesvc"
"github.com/go-kit/kit/log"
)
Expand Down
3 changes: 1 addition & 2 deletions profilesvc/endpoints.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package profilesvc

import (
"context"
"net/url"
"strings"

"golang.org/x/net/context"

"github.com/go-kit/kit/endpoint"
httptransport "github.com/go-kit/kit/transport/http"
)
Expand Down
3 changes: 1 addition & 2 deletions profilesvc/middlewares.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package profilesvc

import (
"context"
"time"

"golang.org/x/net/context"

"github.com/go-kit/kit/log"
)

Expand Down
3 changes: 1 addition & 2 deletions profilesvc/service.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package profilesvc

import (
"context"
"errors"
"sync"

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

// Service is a simple CRUD interface for user profiles.
Expand Down
3 changes: 1 addition & 2 deletions profilesvc/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ package profilesvc

import (
"bytes"
"context"
"encoding/json"
"errors"
"io/ioutil"
"net/http"

"net/url"

"github.com/gorilla/mux"
"golang.org/x/net/context"

"github.com/go-kit/kit/log"
httptransport "github.com/go-kit/kit/transport/http"
Expand Down
3 changes: 1 addition & 2 deletions shipping/booking/endpoint.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package booking

import (
"context"
"time"

"golang.org/x/net/context"

"github.com/go-kit/kit/endpoint"

"github.com/go-kit/kit/examples/shipping/cargo"
Expand Down
2 changes: 1 addition & 1 deletion shipping/booking/transport.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package booking

import (
"context"
"encoding/json"
"errors"
"net/http"
"time"

"github.com/gorilla/mux"
"golang.org/x/net/context"

kitlog "github.com/go-kit/kit/log"
kithttp "github.com/go-kit/kit/transport/http"
Expand Down
3 changes: 1 addition & 2 deletions shipping/handling/endpoint.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package handling

import (
"context"
"time"

"golang.org/x/net/context"

"github.com/go-kit/kit/endpoint"

"github.com/go-kit/kit/examples/shipping/cargo"
Expand Down
2 changes: 1 addition & 1 deletion shipping/handling/transport.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package handling

import (
"context"
"encoding/json"
"net/http"
"time"

"github.com/gorilla/mux"
"golang.org/x/net/context"

kitlog "github.com/go-kit/kit/log"
kithttp "github.com/go-kit/kit/transport/http"
Expand Down
4 changes: 3 additions & 1 deletion shipping/inspection/inspection.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Package inspection provides means to inspect cargos.
package inspection

import "github.com/go-kit/kit/examples/shipping/cargo"
import (
"github.com/go-kit/kit/examples/shipping/cargo"
)

// EventHandler provides means of subscribing to inspection events.
type EventHandler interface {
Expand Down
4 changes: 3 additions & 1 deletion shipping/location/location.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Package location provides the Location aggregate.
package location

import "errors"
import (
"errors"
)

// UNLocode is the United Nations location code that uniquely identifies a
// particular location.
Expand Down
2 changes: 1 addition & 1 deletion shipping/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"context"
"flag"
"fmt"
"net/http"
Expand All @@ -11,7 +12,6 @@ import (
"time"

stdprometheus "github.com/prometheus/client_golang/prometheus"
"golang.org/x/net/context"

"github.com/go-kit/kit/log"
kitprometheus "github.com/go-kit/kit/metrics/prometheus"
Expand Down
3 changes: 1 addition & 2 deletions shipping/routing/proxying.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package routing

import (
"context"
"encoding/json"
"net/http"
"net/url"
"time"

"golang.org/x/net/context"

"github.com/go-kit/kit/circuitbreaker"
"github.com/go-kit/kit/endpoint"
kithttp "github.com/go-kit/kit/transport/http"
Expand Down
4 changes: 3 additions & 1 deletion shipping/routing/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
// bounded context.
package routing

import "github.com/go-kit/kit/examples/shipping/cargo"
import (
"github.com/go-kit/kit/examples/shipping/cargo"
)

// Service provides access to an external routing service.
type Service interface {
Expand Down
2 changes: 1 addition & 1 deletion shipping/tracking/endpoint.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tracking

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

"github.com/go-kit/kit/endpoint"
)
Expand Down
2 changes: 1 addition & 1 deletion shipping/tracking/transport.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package tracking

import (
"context"
"encoding/json"
"errors"
"net/http"

"github.com/gorilla/mux"
"golang.org/x/net/context"

kitlog "github.com/go-kit/kit/log"
kithttp "github.com/go-kit/kit/transport/http"
Expand Down
3 changes: 1 addition & 2 deletions stringsvc1/main.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package main

import (
"context"
"encoding/json"
"errors"
"log"
"net/http"
"strings"

"golang.org/x/net/context"

"github.com/go-kit/kit/endpoint"
httptransport "github.com/go-kit/kit/transport/http"
)
Expand Down
2 changes: 1 addition & 1 deletion stringsvc2/main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package main

import (
"context"
"net/http"
"os"

stdprometheus "github.com/prometheus/client_golang/prometheus"
"golang.org/x/net/context"

"github.com/go-kit/kit/log"
kitprometheus "github.com/go-kit/kit/metrics/prometheus"
Expand Down
3 changes: 1 addition & 2 deletions stringsvc2/transport.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package main

import (
"context"
"encoding/json"
"net/http"

"golang.org/x/net/context"

"github.com/go-kit/kit/endpoint"
)

Expand Down
2 changes: 1 addition & 1 deletion stringsvc3/main.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package main

import (
"context"
"flag"
"net/http"
"os"

stdprometheus "github.com/prometheus/client_golang/prometheus"
"golang.org/x/net/context"

"github.com/go-kit/kit/log"
kitprometheus "github.com/go-kit/kit/metrics/prometheus"
Expand Down
Loading

0 comments on commit 4366e8c

Please sign in to comment.