Skip to content

Commit

Permalink
Update golang.org/x/net/context -> context. Live in the now. Mutually…
Browse files Browse the repository at this point in the history
… exclusive with go 1.7
  • Loading branch information
mdubbyap committed Dec 19, 2017
1 parent 2cb1e61 commit 1bb0e75
Show file tree
Hide file tree
Showing 45 changed files with 57 additions and 51 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ language: go
sudo: false

go:
- 1.7
- 1.8
- 1.9

Expand Down
2 changes: 1 addition & 1 deletion boltcycle/boltcycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/signalfx/golib/errors"

"context"
"github.com/boltdb/bolt"
"golang.org/x/net/context"
)

// CycleDB allows you to use a bolt.DB as a pseudo-LRU using a cycle of buckets
Expand Down
5 changes: 3 additions & 2 deletions boltcycle/boltcycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (

"bytes"

"context"
"github.com/boltdb/bolt"
"github.com/signalfx/golib/log"
. "github.com/smartystreets/goconvey/convey"
"github.com/stretchr/testify/require"
"golang.org/x/net/context"
)

type testSetup struct {
Expand Down Expand Up @@ -279,8 +279,9 @@ func TestAsyncWrite(t *testing.T) {
Convey("and channel is full", func() {
c.readMovements = make(chan readToLocation)
Convey("Async write should timeout", func() {
ctx, _ := context.WithTimeout(context.Background(), time.Millisecond)
ctx, cancelfunc := context.WithTimeout(context.Background(), time.Millisecond)
c.AsyncWrite(ctx, []KvPair{{}})
cancelfunc()
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion clientcfg/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
"sync"
"time"

"context"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/distconf"
"github.com/signalfx/golib/errors"
"github.com/signalfx/golib/log"
"github.com/signalfx/golib/logkey"
"github.com/signalfx/golib/sfxclient"
"github.com/signalfx/golib/timekeeper"
"golang.org/x/net/context"
)

// ClientConfig configures a SfxClient
Expand Down
2 changes: 1 addition & 1 deletion clientcfg/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"net/url"
"testing"

"context"
"github.com/signalfx/golib/datapoint/dptest"
"github.com/signalfx/golib/distconf"
"github.com/signalfx/golib/log"
"github.com/signalfx/golib/sfxclient"
. "github.com/smartystreets/goconvey/convey"
"golang.org/x/net/context"
)

func TestClient(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion datapoint/dpsink/counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"sync/atomic"
"time"

"context"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/event"
"github.com/signalfx/golib/log"
"github.com/signalfx/golib/sfxclient"
"golang.org/x/net/context"
)

// DefaultLogger is used by package structs that don't have a default logger set.
Expand Down
2 changes: 1 addition & 1 deletion datapoint/dpsink/counter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (

"sync/atomic"

"context"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/datapoint/dptest"
"github.com/signalfx/golib/event"
"github.com/signalfx/golib/log"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
)

const numTests = 7
Expand Down
2 changes: 1 addition & 1 deletion datapoint/dpsink/discard.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dpsink

import (
"context"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/event"
"golang.org/x/net/context"
)

type discardSink struct {
Expand Down
2 changes: 1 addition & 1 deletion datapoint/dpsink/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package dpsink
import (
"sync/atomic"

"context"
"github.com/signalfx/golib/datapoint"
"golang.org/x/net/context"
)

// EmptyMetricFilter filters empty metric name datapoints
Expand Down
2 changes: 1 addition & 1 deletion datapoint/dpsink/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"runtime"
"testing"

"context"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/datapoint/dptest"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
)

func TestEmptyMetricFilter(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion datapoint/dpsink/logfilter.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package dpsink

import (
"context"
"encoding/json"
"expvar"
"fmt"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/event"
"github.com/signalfx/golib/log"
"golang.org/x/net/context"
"net/http"
"sync"
"sync/atomic"
Expand Down
2 changes: 1 addition & 1 deletion datapoint/dpsink/logfilter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"testing"
"time"

"context"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/event"
"github.com/signalfx/golib/log"
. "github.com/smartystreets/goconvey/convey"
"golang.org/x/net/context"
)

type boolFlagCheck bool
Expand Down
2 changes: 1 addition & 1 deletion datapoint/dpsink/ratelimitlogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"sync/atomic"
"time"

"context"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/event"
"github.com/signalfx/golib/log"
"golang.org/x/net/context"
)

// RateLimitErrorLogging does a log of errors forwarding points in a rate limited manner
Expand Down
2 changes: 1 addition & 1 deletion datapoint/dpsink/ratelimitlogger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"testing"
"time"

"context"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/datapoint/dptest"
"github.com/signalfx/golib/event"
"github.com/signalfx/golib/log"
. "github.com/smartystreets/goconvey/convey"
"golang.org/x/net/context"
)

func TestRateLimitErrorLogging(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion datapoint/dpsink/sink.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dpsink

import (
"context"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/event"
"golang.org/x/net/context"
)

// A DSink is an object that can accept datapoints and do something with them, like forward them
Expand Down
2 changes: 1 addition & 1 deletion datapoint/dpsink/sink_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package dpsink

import (
"context"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/datapoint/dptest"
"github.com/signalfx/golib/event"
"github.com/signalfx/golib/log"
. "github.com/smartystreets/goconvey/convey"
"golang.org/x/net/context"
"testing"
)

Expand Down
2 changes: 1 addition & 1 deletion datapoint/dptest/basicsink.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package dptest
import (
"sync"

"context"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/event"
"golang.org/x/net/context"
)

// BasicSink is a pure testing sink that blocks forwarded points onto a channel
Expand Down
2 changes: 1 addition & 1 deletion datapoint/dptest/basicsink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"errors"
"testing"

"context"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/event"
"github.com/signalfx/golib/log"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
)

func TestBasicSink(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion log/ctxdims.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package log

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

// CtxDimensions can propagate log dimensions inside a context object
type CtxDimensions struct {
Expand Down
2 changes: 1 addition & 1 deletion log/ctxdims_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package log

import (
"bytes"
"context"
. "github.com/smartystreets/goconvey/convey"
"golang.org/x/net/context"
"testing"
)

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

import (
"bytes"
"context"
"github.com/boltdb/bolt"
"github.com/signalfx/golib/boltcycle"
"github.com/signalfx/golib/errors"
"golang.org/x/net/context"
"io/ioutil"
"os"
"path/filepath"
Expand Down
16 changes: 10 additions & 6 deletions pdbcycle/pdbcycle_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package pdbcycle

import (
"context"
"errors"
"github.com/boltdb/bolt"
"github.com/signalfx/golib/boltcycle"
. "github.com/smartystreets/goconvey/convey"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
"io/ioutil"
"os"
"path/filepath"
Expand Down Expand Up @@ -158,11 +158,15 @@ func Test(t *testing.T) {
So(err, ShouldBeNil)
So(len(infos), ShouldEqual, 3)
Convey("can only get data that was accessed, not the non accessed data", func() {
data, err := pdb.Read([][]byte{[]byte("first"), []byte("firsttwo")})
So(err, ShouldBeNil)
So(len(data), ShouldEqual, 2)
So(string(data[0]), ShouldEqual, "")
So(string(data[1]), ShouldEqual, "firsttwodata")
for {
data, err := pdb.Read([][]byte{[]byte("first"), []byte("firsttwo")})
So(err, ShouldBeNil)
So(len(data), ShouldEqual, 2)
if string(data[0]) == "" && string(data[1]) == "firsttwodata" {
break
}
runtime.Gosched()
}
Convey("close and reopen", func() {
So(pdb.Close(), ShouldBeNil)
pdb, err = New(dir,
Expand Down
2 changes: 1 addition & 1 deletion sfxclient/cancel14.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package sfxclient
import (
"net/http"

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

type canceler interface {
Expand Down
2 changes: 1 addition & 1 deletion sfxclient/cancel14_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package sfxclient

import "net/http"
import "golang.org/x/net/context"
import "context"
import "testing"

func cancelChanFromReq(req *http.Request) <-chan struct{} {
Expand Down
2 changes: 1 addition & 1 deletion sfxclient/cancel15.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package sfxclient
import (
"net/http"

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

func (h *HTTPSink) withCancel(ctx context.Context, req *http.Request) (err error) {
Expand Down
2 changes: 1 addition & 1 deletion sfxclient/cumulativebucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"sync"
"testing"

"context"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/log"
. "github.com/smartystreets/goconvey/convey"
"golang.org/x/net/context"
)

func dpNamed(name string, dps []*datapoint.Datapoint) *datapoint.Datapoint {
Expand Down
2 changes: 1 addition & 1 deletion sfxclient/httpsink.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import (
"time"
"unicode"

"context"
"github.com/golang/protobuf/proto"
"github.com/signalfx/com_signalfx_metrics_protobuf"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/errors"
"github.com/signalfx/golib/event"
"golang.org/x/net/context"
)

// ClientVersion is the version of this library and is embedded into the user agent
Expand Down
4 changes: 3 additions & 1 deletion sfxclient/httpsink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import (
"net"
"strings"

"context"
"github.com/golang/protobuf/proto"
"github.com/signalfx/com_signalfx_metrics_protobuf"
"github.com/signalfx/golib/datapoint"
"github.com/signalfx/golib/errors"
"github.com/signalfx/golib/event"
"github.com/signalfx/golib/log"
. "github.com/smartystreets/goconvey/convey"
"golang.org/x/net/context"
)

type errReader struct {
Expand Down Expand Up @@ -267,6 +267,7 @@ func TestHTTPDatapointSink(t *testing.T) {
if !strings.Contains(s, "canceled") && !strings.Contains(s, "closed") {
t.Errorf("Bad error string %s", s)
}
cancelCallback()
})
Convey("timeouts should work", func() {
blockResponse = make(chan struct{})
Expand Down Expand Up @@ -473,6 +474,7 @@ func TestHTTPEventSink(t *testing.T) {
if !strings.Contains(s, "canceled") && !strings.Contains(s, "closed") {
t.Errorf("Bad error string %s", s)
}
cancelCallback()
})
Convey("timeouts should work", func() {
blockResponse = make(chan struct{})
Expand Down
2 changes: 1 addition & 1 deletion sfxclient/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"testing"
"time"

"context"
"github.com/signalfx/golib/datapoint"
. "github.com/smartystreets/goconvey/convey"
"golang.org/x/net/context"
)

type tokenInfo struct {
Expand Down
Loading

0 comments on commit 1bb0e75

Please sign in to comment.