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

Use stdlib context instead of golang.org/x/net/context #421

Merged
merged 6 commits into from
Feb 4, 2017
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
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"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can remove empty line-break

"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