Skip to content

Commit

Permalink
Merge pull request #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 4eb1e49 + 1f1ad4d commit c5e750d
Show file tree
Hide file tree
Showing 77 changed files with 111 additions and 122 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ language: go
script: go test -race -v ./...

go:
- 1.5.4
- 1.6.3
- 1.7.1
- 1.7.4
- 1.8beta2
- tip
2 changes: 1 addition & 1 deletion auth/jwt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Example of use in a server:

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

"github.com/go-kit/kit/auth/jwt"
"github.com/go-kit/kit/log"
Expand Down
2 changes: 1 addition & 1 deletion auth/jwt/middleware.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package jwt

import (
"context"
"errors"

jwt "github.com/dgrijalva/jwt-go"
"golang.org/x/net/context"

"github.com/go-kit/kit/endpoint"
)
Expand Down
3 changes: 1 addition & 2 deletions auth/jwt/middleware_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package jwt

import (
"context"
"testing"

jwt "github.com/dgrijalva/jwt-go"

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

var (
Expand Down
2 changes: 1 addition & 1 deletion auth/jwt/transport.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package jwt

import (
"context"
"fmt"
stdhttp "net/http"
"strings"

"golang.org/x/net/context"
"google.golang.org/grpc/metadata"

"github.com/go-kit/kit/transport/grpc"
Expand Down
3 changes: 1 addition & 2 deletions auth/jwt/transport_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package jwt

import (
"context"
"fmt"
"net/http"
"testing"

"google.golang.org/grpc/metadata"

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

func TestToHTTPContext(t *testing.T) {
Expand Down
3 changes: 3 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
machine:
pre:
- curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0
- sudo rm -rf /usr/local/go
- curl -sSL https://storage.googleapis.com/golang/go1.7.4.linux-amd64.tar.gz | sudo tar xz -C /usr/local
services:
- docker

Expand All @@ -14,6 +16,7 @@ test:
pre:
- mkdir -p /home/ubuntu/.go_workspace/src/github.com/go-kit
- mv /home/ubuntu/kit /home/ubuntu/.go_workspace/src/github.com/go-kit
- ln -s /home/ubuntu/.go_workspace/src/github.com/go-kit/kit /home/ubuntu/kit
- go get github.com/go-kit/kit/...
override:
- go test -v -race -tags integration github.com/go-kit/kit/...:
Expand Down
3 changes: 2 additions & 1 deletion circuitbreaker/gobreaker.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package circuitbreaker

import (
"context"

"github.com/sony/gobreaker"
"golang.org/x/net/context"

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

import (
"context"
"time"

"github.com/streadway/handy/breaker"
"golang.org/x/net/context"

"github.com/go-kit/kit/endpoint"
)
Expand Down
3 changes: 2 additions & 1 deletion circuitbreaker/hystrix.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package circuitbreaker

import (
"context"

"github.com/afex/hystrix-go/hystrix"
"golang.org/x/net/context"

"github.com/go-kit/kit/endpoint"
)
Expand Down
3 changes: 1 addition & 2 deletions circuitbreaker/util_test.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package circuitbreaker_test

import (
"context"
"errors"
"fmt"
"path/filepath"
"runtime"
"testing"
"time"

"golang.org/x/net/context"

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

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

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

// Endpoint is the fundamental building block of servers and clients.
Expand Down
3 changes: 1 addition & 2 deletions endpoint/endpoint_example_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package endpoint_test

import (
"context"
"fmt"

"golang.org/x/net/context"

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

Expand Down
2 changes: 1 addition & 1 deletion examples/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 examples/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 examples/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 examples/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 examples/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 examples/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 examples/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 examples/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 examples/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 examples/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 examples/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 examples/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 examples/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 examples/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 examples/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 examples/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
Loading

0 comments on commit c5e750d

Please sign in to comment.