From 6e2cb00008cbf09e556b00f87603797fcaa47e09 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 16 Apr 2018 05:37:14 -0700 Subject: Depenancy upgrades and movign to dep. (#8630) --- .../segmentio/analytics-go/Godeps/Godeps.json | 17 - .../segmentio/analytics-go/Godeps/Readme | 5 - .../analytics-go/Godeps/_workspace/.gitignore | 2 - .../src/github.com/jehiah/go-strftime/.gitignore | 22 - .../src/github.com/jehiah/go-strftime/README.md | 4 - .../src/github.com/jehiah/go-strftime/strftime.go | 71 --- .../github.com/jehiah/go-strftime/strftime_test.go | 40 -- .../_workspace/src/github.com/xtgo/uuid/uuid.go | 204 --------- .../src/github.com/xtgo/uuid/uuid_test.go | 102 ----- .../segmentio/analytics-go/analytics_test.go | 478 --------------------- .../segmentio/analytics-go/examples/track.go | 36 -- vendor/github.com/segmentio/backo-go/backo_test.go | 77 ---- .../vendor/github.com/bmizerany/assert/.gitignore | 7 - .../vendor/github.com/bmizerany/assert/README.md | 45 -- .../vendor/github.com/bmizerany/assert/assert.go | 76 ---- .../github.com/bmizerany/assert/assert_test.go | 15 - .../github.com/bmizerany/assert/example/point.go | 5 - .../bmizerany/assert/example/point_test.go | 13 - 18 files changed, 1219 deletions(-) delete mode 100644 vendor/github.com/segmentio/analytics-go/Godeps/Godeps.json delete mode 100644 vendor/github.com/segmentio/analytics-go/Godeps/Readme delete mode 100644 vendor/github.com/segmentio/analytics-go/Godeps/_workspace/.gitignore delete mode 100644 vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/jehiah/go-strftime/.gitignore delete mode 100644 vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/jehiah/go-strftime/README.md delete mode 100644 vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/jehiah/go-strftime/strftime.go delete mode 100644 vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/jehiah/go-strftime/strftime_test.go delete mode 100644 vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/xtgo/uuid/uuid.go delete mode 100644 vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/xtgo/uuid/uuid_test.go delete mode 100644 vendor/github.com/segmentio/analytics-go/analytics_test.go delete mode 100644 vendor/github.com/segmentio/analytics-go/examples/track.go delete mode 100644 vendor/github.com/segmentio/backo-go/backo_test.go delete mode 100644 vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/.gitignore delete mode 100644 vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/README.md delete mode 100644 vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/assert.go delete mode 100644 vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/assert_test.go delete mode 100644 vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/example/point.go delete mode 100644 vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/example/point_test.go (limited to 'vendor/github.com/segmentio') diff --git a/vendor/github.com/segmentio/analytics-go/Godeps/Godeps.json b/vendor/github.com/segmentio/analytics-go/Godeps/Godeps.json deleted file mode 100644 index e1b79eb2d..000000000 --- a/vendor/github.com/segmentio/analytics-go/Godeps/Godeps.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "ImportPath": "github.com/segmentio/analytics-go", - "GoVersion": "go1.4.2", - "Packages": [ - "./..." - ], - "Deps": [ - { - "ImportPath": "github.com/jehiah/go-strftime", - "Rev": "834e15c05a45371503440cc195bbd05c9a0968d9" - }, - { - "ImportPath": "github.com/xtgo/uuid", - "Rev": "a0b114877d4caeffbd7f87e3757c17fce570fea7" - } - ] -} diff --git a/vendor/github.com/segmentio/analytics-go/Godeps/Readme b/vendor/github.com/segmentio/analytics-go/Godeps/Readme deleted file mode 100644 index 4cdaa53d5..000000000 --- a/vendor/github.com/segmentio/analytics-go/Godeps/Readme +++ /dev/null @@ -1,5 +0,0 @@ -This directory tree is generated automatically by godep. - -Please do not edit. - -See https://github.com/tools/godep for more information. diff --git a/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/.gitignore b/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/.gitignore deleted file mode 100644 index f037d684e..000000000 --- a/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/pkg -/bin diff --git a/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/jehiah/go-strftime/.gitignore b/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/jehiah/go-strftime/.gitignore deleted file mode 100644 index 00268614f..000000000 --- a/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/jehiah/go-strftime/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe diff --git a/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/jehiah/go-strftime/README.md b/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/jehiah/go-strftime/README.md deleted file mode 100644 index 8eb240384..000000000 --- a/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/jehiah/go-strftime/README.md +++ /dev/null @@ -1,4 +0,0 @@ -go-strftime -=========== - -go implementation of strftime \ No newline at end of file diff --git a/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/jehiah/go-strftime/strftime.go b/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/jehiah/go-strftime/strftime.go deleted file mode 100644 index 99e26716f..000000000 --- a/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/jehiah/go-strftime/strftime.go +++ /dev/null @@ -1,71 +0,0 @@ -// go implementation of strftime -package strftime - -import ( - "strings" - "time" -) - -// taken from time/format.go -var conversion = map[rune]string { - /*stdLongMonth */ 'B':"January", - /*stdMonth */ 'b': "Jan", - // stdNumMonth */ 'm': "1", - /*stdZeroMonth */ 'm': "01", - /*stdLongWeekDay */ 'A': "Monday", - /*stdWeekDay */ 'a': "Mon", - // stdDay */ 'd': "2", - // stdUnderDay */ 'd': "_2", - /*stdZeroDay */ 'd': "02", - /*stdHour */ 'H': "15", - // stdHour12 */ 'I': "3", - /*stdZeroHour12 */ 'I': "03", - // stdMinute */ 'M': "4", - /*stdZeroMinute */ 'M': "04", - // stdSecond */ 'S': "5", - /*stdZeroSecond */ 'S': "05", - /*stdLongYear */ 'Y': "2006", - /*stdYear */ 'y': "06", - /*stdPM */ 'p': "PM", - // stdpm */ 'p': "pm", - /*stdTZ */ 'Z': "MST", - // stdISO8601TZ */ 'z': "Z0700", // prints Z for UTC - // stdISO8601ColonTZ */ 'z': "Z07:00", // prints Z for UTC - /*stdNumTZ */ 'z': "-0700", // always numeric - // stdNumShortTZ */ 'b': "-07", // always numeric - // stdNumColonTZ */ 'b': "-07:00", // always numeric -} - -// This is an alternative to time.Format because no one knows -// what date 040305 is supposed to create when used as a 'layout' string -// this takes standard strftime format options. For a complete list -// of format options see http://strftime.org/ -func Format(format string, t time.Time) string { - retval := make([]byte, 0, len(format)) - for i, ni := 0, 0; i < len(format); i = ni + 2 { - ni = strings.IndexByte(format[i:], '%') - if ni < 0 { - ni = len(format) - } else { - ni += i - } - retval = append(retval, []byte(format[i:ni])...) - if ni + 1 < len(format) { - c := format[ni + 1] - if c == '%' { - retval = append(retval, '%') - } else { - if layoutCmd, ok := conversion[rune(c)]; ok { - retval = append(retval, []byte(t.Format(layoutCmd))...) - } else { - retval = append(retval, '%', c) - } - } - } else { - if ni < len(format) { - retval = append(retval, '%') - } - } - } - return string(retval) -} diff --git a/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/jehiah/go-strftime/strftime_test.go b/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/jehiah/go-strftime/strftime_test.go deleted file mode 100644 index 45cbca345..000000000 --- a/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/jehiah/go-strftime/strftime_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package strftime - -import ( - "time" - "fmt" - "testing" -) - -func ExampleFormat() { - t := time.Unix(1340244776, 0) - utc, _ := time.LoadLocation("UTC") - t = t.In(utc) - fmt.Println(Format("%Y-%m-%d %H:%M:%S", t)) - // Output: - // 2012-06-21 02:12:56 -} - -func TestNoLeadingPercentSign(t *testing.T) { - tm := time.Unix(1340244776, 0) - utc, _ := time.LoadLocation("UTC") - tm = tm.In(utc) - result := Format("aaabbb0123456789%Y", tm) - if result != "aaabbb01234567892012" { - t.Logf("%s != %s", result, "aaabbb01234567892012") - t.Fail() - } -} - - -func TestUnsupported(t *testing.T) { - tm := time.Unix(1340244776, 0) - utc, _ := time.LoadLocation("UTC") - tm = tm.In(utc) - result := Format("%0%1%%%2", tm) - if result != "%0%1%%2" { - t.Logf("%s != %s", result, "%0%1%%2") - t.Fail() - } -} - diff --git a/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/xtgo/uuid/uuid.go b/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/xtgo/uuid/uuid.go deleted file mode 100644 index a0fd7a5a5..000000000 --- a/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/xtgo/uuid/uuid.go +++ /dev/null @@ -1,204 +0,0 @@ -// Copyright (c) 2012 The gocql Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package uuid can be used to generate and parse universally unique -// identifiers, a standardized format in the form of a 128 bit number. -// -// http://tools.ietf.org/html/rfc4122 -package uuid - -import ( - "crypto/rand" - "encoding/hex" - "errors" - "io" - "net" - "strconv" - "time" -) - -type UUID [16]byte - -var hardwareAddr []byte - -const ( - VariantNCSCompat = 0 - VariantIETF = 2 - VariantMicrosoft = 6 - VariantFuture = 7 -) - -func init() { - if interfaces, err := net.Interfaces(); err == nil { - for _, i := range interfaces { - if i.Flags&net.FlagLoopback == 0 && len(i.HardwareAddr) > 0 { - hardwareAddr = i.HardwareAddr - break - } - } - } - if hardwareAddr == nil { - // If we failed to obtain the MAC address of the current computer, - // we will use a randomly generated 6 byte sequence instead and set - // the multicast bit as recommended in RFC 4122. - hardwareAddr = make([]byte, 6) - _, err := io.ReadFull(rand.Reader, hardwareAddr) - if err != nil { - panic(err) - } - hardwareAddr[0] = hardwareAddr[0] | 0x01 - } -} - -// Parse parses a 32 digit hexadecimal number (that might contain hyphens) -// representing an UUID. -func Parse(input string) (UUID, error) { - var u UUID - j := 0 - for i := 0; i < len(input); i++ { - b := input[i] - switch { - default: - fallthrough - case j == 32: - goto err - case b == '-': - continue - case '0' <= b && b <= '9': - b -= '0' - case 'a' <= b && b <= 'f': - b -= 'a' - 10 - case 'A' <= b && b <= 'F': - b -= 'A' - 10 - } - u[j/2] |= b << byte(^j&1<<2) - j++ - } - if j == 32 { - return u, nil - } -err: - return UUID{}, errors.New("invalid UUID " + strconv.Quote(input)) -} - -// FromBytes converts a raw byte slice to an UUID. It will panic if the slice -// isn't exactly 16 bytes long. -func FromBytes(input []byte) UUID { - var u UUID - if len(input) != 16 { - panic("UUIDs must be exactly 16 bytes long") - } - copy(u[:], input) - return u -} - -// NewRandom generates a totally random UUID (version 4) as described in -// RFC 4122. -func NewRandom() UUID { - var u UUID - io.ReadFull(rand.Reader, u[:]) - u[6] &= 0x0F // clear version - u[6] |= 0x40 // set version to 4 (random uuid) - u[8] &= 0x3F // clear variant - u[8] |= 0x80 // set to IETF variant - return u -} - -var timeBase = time.Date(1582, time.October, 15, 0, 0, 0, 0, time.UTC).Unix() - -// NewTime generates a new time based UUID (version 1) as described in RFC -// 4122. This UUID contains the MAC address of the node that generated the -// UUID, a timestamp and a sequence number. -func NewTime() UUID { - var u UUID - - now := time.Now().In(time.UTC) - t := uint64(now.Unix()-timeBase)*10000000 + uint64(now.Nanosecond()/100) - u[0], u[1], u[2], u[3] = byte(t>>24), byte(t>>16), byte(t>>8), byte(t) - u[4], u[5] = byte(t>>40), byte(t>>32) - u[6], u[7] = byte(t>>56)&0x0F, byte(t>>48) - - var clockSeq [2]byte - io.ReadFull(rand.Reader, clockSeq[:]) - u[8] = clockSeq[1] - u[9] = clockSeq[0] - - copy(u[10:], hardwareAddr) - - u[6] |= 0x10 // set version to 1 (time based uuid) - u[8] &= 0x3F // clear variant - u[8] |= 0x80 // set to IETF variant - - return u -} - -// String returns the UUID in it's canonical form, a 32 digit hexadecimal -// number in the form of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. -func (u UUID) String() string { - buf := [36]byte{8: '-', 13: '-', 18: '-', 23: '-'} - hex.Encode(buf[0:], u[0:4]) - hex.Encode(buf[9:], u[4:6]) - hex.Encode(buf[14:], u[6:8]) - hex.Encode(buf[19:], u[8:10]) - hex.Encode(buf[24:], u[10:]) - return string(buf[:]) -} - -// Bytes returns the raw byte slice for this UUID. A UUID is always 128 bits -// (16 bytes) long. -func (u UUID) Bytes() []byte { - return u[:] -} - -// Variant returns the variant of this UUID. This package will only generate -// UUIDs in the IETF variant. -func (u UUID) Variant() int { - x := u[8] - switch byte(0) { - case x & 0x80: - return VariantNCSCompat - case x & 0x40: - return VariantIETF - case x & 0x20: - return VariantMicrosoft - } - return VariantFuture -} - -// Version extracts the version of this UUID variant. The RFC 4122 describes -// five kinds of UUIDs. -func (u UUID) Version() int { - return int(u[6] & 0xF0 >> 4) -} - -// Node extracts the MAC address of the node who generated this UUID. It will -// return nil if the UUID is not a time based UUID (version 1). -func (u UUID) Node() []byte { - if u.Version() != 1 { - return nil - } - return u[10:] -} - -// Timestamp extracts the timestamp information from a time based UUID -// (version 1). -func (u UUID) Timestamp() uint64 { - if u.Version() != 1 { - return 0 - } - return uint64(u[0])<<24 + uint64(u[1])<<16 + uint64(u[2])<<8 + - uint64(u[3]) + uint64(u[4])<<40 + uint64(u[5])<<32 + - uint64(u[7])<<48 + uint64(u[6]&0x0F)<<56 -} - -// Time is like Timestamp, except that it returns a time.Time. -func (u UUID) Time() time.Time { - t := u.Timestamp() - if t == 0 { - return time.Time{} - } - sec := t / 10000000 - nsec := t - sec - return time.Unix(int64(sec)+timeBase, int64(nsec)) -} diff --git a/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/xtgo/uuid/uuid_test.go b/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/xtgo/uuid/uuid_test.go deleted file mode 100644 index 3cef4a31a..000000000 --- a/vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/xtgo/uuid/uuid_test.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2012 The gocql Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "bytes" - "testing" -) - -func TestNil(t *testing.T) { - var uuid UUID - want, got := "00000000-0000-0000-0000-000000000000", uuid.String() - if want != got { - t.Fatalf("TestNil: expected %q got %q", want, got) - } -} - -var tests = []struct { - input string - variant int - version int -}{ - {"b4f00409-cef8-4822-802c-deb20704c365", VariantIETF, 4}, - {"f81d4fae-7dec-11d0-a765-00a0c91e6bf6", VariantIETF, 1}, - {"00000000-7dec-11d0-a765-00a0c91e6bf6", VariantIETF, 1}, - {"3051a8d7-aea7-1801-e0bf-bc539dd60cf3", VariantFuture, 1}, - {"3051a8d7-aea7-2801-e0bf-bc539dd60cf3", VariantFuture, 2}, - {"3051a8d7-aea7-3801-e0bf-bc539dd60cf3", VariantFuture, 3}, - {"3051a8d7-aea7-4801-e0bf-bc539dd60cf3", VariantFuture, 4}, - {"3051a8d7-aea7-3801-e0bf-bc539dd60cf3", VariantFuture, 5}, - {"d0e817e1-e4b1-1801-3fe6-b4b60ccecf9d", VariantNCSCompat, 0}, - {"d0e817e1-e4b1-1801-bfe6-b4b60ccecf9d", VariantIETF, 1}, - {"d0e817e1-e4b1-1801-dfe6-b4b60ccecf9d", VariantMicrosoft, 0}, - {"d0e817e1-e4b1-1801-ffe6-b4b60ccecf9d", VariantFuture, 0}, -} - -func TestPredefined(t *testing.T) { - for i := range tests { - uuid, err := Parse(tests[i].input) - if err != nil { - t.Errorf("Parse #%d: %v", i, err) - continue - } - - if str := uuid.String(); str != tests[i].input { - t.Errorf("String #%d: expected %q got %q", i, tests[i].input, str) - continue - } - - if variant := uuid.Variant(); variant != tests[i].variant { - t.Errorf("Variant #%d: expected %d got %d", i, tests[i].variant, variant) - } - - if tests[i].variant == VariantIETF { - if version := uuid.Version(); version != tests[i].version { - t.Errorf("Version #%d: expected %d got %d", i, tests[i].version, version) - } - } - } -} - -func TestNewRandom(t *testing.T) { - for i := 0; i < 20; i++ { - uuid := NewRandom() - - if variant := uuid.Variant(); variant != VariantIETF { - t.Errorf("wrong variant. expected %d got %d", VariantIETF, variant) - } - if version := uuid.Version(); version != 4 { - t.Errorf("wrong version. expected %d got %d", 4, version) - } - } -} - -func TestNewTime(t *testing.T) { - var node []byte - timestamp := uint64(0) - for i := 0; i < 20; i++ { - uuid := NewTime() - - if variant := uuid.Variant(); variant != VariantIETF { - t.Errorf("wrong variant. expected %d got %d", VariantIETF, variant) - } - if version := uuid.Version(); version != 1 { - t.Errorf("wrong version. expected %d got %d", 1, version) - } - - if n := uuid.Node(); !bytes.Equal(n, node) && i > 0 { - t.Errorf("wrong node. expected %x, got %x", node, n) - } else if i == 0 { - node = n - } - - ts := uuid.Timestamp() - if ts < timestamp { - t.Errorf("timestamps must grow") - } - timestamp = ts - } -} diff --git a/vendor/github.com/segmentio/analytics-go/analytics_test.go b/vendor/github.com/segmentio/analytics-go/analytics_test.go deleted file mode 100644 index c6f0dc4f2..000000000 --- a/vendor/github.com/segmentio/analytics-go/analytics_test.go +++ /dev/null @@ -1,478 +0,0 @@ -package analytics - -import "net/http/httptest" -import "encoding/json" -import "net/http" -import "testing" -import "bytes" -import "time" -import "fmt" -import "io" - -func mockId() string { return "I'm unique" } - -func mockTime() time.Time { - // time.Unix(0, 0) fails on Circle - return time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC) -} - -func mockServer() (chan []byte, *httptest.Server) { - done := make(chan []byte, 1) - - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - buf := bytes.NewBuffer(nil) - io.Copy(buf, r.Body) - - var v interface{} - err := json.Unmarshal(buf.Bytes(), &v) - if err != nil { - panic(err) - } - - b, err := json.MarshalIndent(v, "", " ") - if err != nil { - panic(err) - } - - done <- b - })) - - return done, server -} - -func ExampleTrack() { - body, server := mockServer() - defer server.Close() - - client := New("h97jamjwbh") - client.Endpoint = server.URL - client.now = mockTime - client.uid = mockId - client.Size = 1 - - client.Track(&Track{ - Event: "Download", - UserId: "123456", - Properties: map[string]interface{}{ - "application": "Segment Desktop", - "version": "1.1.0", - "platform": "osx", - }, - }) - - fmt.Printf("%s\n", <-body) - // Output: - // { - // "batch": [ - // { - // "event": "Download", - // "messageId": "I'm unique", - // "properties": { - // "application": "Segment Desktop", - // "platform": "osx", - // "version": "1.1.0" - // }, - // "timestamp": "2009-11-10T23:00:00+0000", - // "type": "track", - // "userId": "123456" - // } - // ], - // "context": { - // "library": { - // "name": "analytics-go", - // "version": "2.1.0" - // } - // }, - // "messageId": "I'm unique", - // "sentAt": "2009-11-10T23:00:00+0000" - // } -} - -func ExampleClose() { - body, server := mockServer() - defer server.Close() - - client := New("h97jamjwbh") - client.Endpoint = server.URL - client.now = mockTime - client.uid = mockId - - client.Track(&Track{ - Event: "Download", - UserId: "123456", - Properties: map[string]interface{}{ - "application": "Segment Desktop", - "version": "1.1.0", - "platform": "osx", - }, - }) - - client.Close() - - fmt.Printf("%s\n", <-body) - // Output: - // { - // "batch": [ - // { - // "event": "Download", - // "messageId": "I'm unique", - // "properties": { - // "application": "Segment Desktop", - // "platform": "osx", - // "version": "1.1.0" - // }, - // "timestamp": "2009-11-10T23:00:00+0000", - // "type": "track", - // "userId": "123456" - // } - // ], - // "context": { - // "library": { - // "name": "analytics-go", - // "version": "2.1.0" - // } - // }, - // "messageId": "I'm unique", - // "sentAt": "2009-11-10T23:00:00+0000" - // } -} - -func ExampleInterval() { - body, server := mockServer() - defer server.Close() - - client := New("h97jamjwbh") - client.Endpoint = server.URL - client.now = mockTime - client.uid = mockId - - client.Track(&Track{ - Event: "Download", - UserId: "123456", - Properties: map[string]interface{}{ - "application": "Segment Desktop", - "version": "1.1.0", - "platform": "osx", - }, - }) - - // Will flush in 5 seconds (default interval). - fmt.Printf("%s\n", <-body) - // Output: - // { - // "batch": [ - // { - // "event": "Download", - // "messageId": "I'm unique", - // "properties": { - // "application": "Segment Desktop", - // "platform": "osx", - // "version": "1.1.0" - // }, - // "timestamp": "2009-11-10T23:00:00+0000", - // "type": "track", - // "userId": "123456" - // } - // ], - // "context": { - // "library": { - // "name": "analytics-go", - // "version": "2.1.0" - // } - // }, - // "messageId": "I'm unique", - // "sentAt": "2009-11-10T23:00:00+0000" - // } -} - -func ExampleTrackWithTimestampSet() { - body, server := mockServer() - defer server.Close() - - client := New("h97jamjwbh") - client.Endpoint = server.URL - client.now = mockTime - client.uid = mockId - client.Size = 1 - - client.Track(&Track{ - Event: "Download", - UserId: "123456", - Properties: map[string]interface{}{ - "application": "Segment Desktop", - "version": "1.1.0", - "platform": "osx", - }, - Message: Message{ - Timestamp: timestamp(time.Date(2015, time.July, 10, 23, 0, 0, 0, time.UTC)), - }, - }) - - fmt.Printf("%s\n", <-body) - // Output: - // { - // "batch": [ - // { - // "event": "Download", - // "messageId": "I'm unique", - // "properties": { - // "application": "Segment Desktop", - // "platform": "osx", - // "version": "1.1.0" - // }, - // "timestamp": "2015-07-10T23:00:00+0000", - // "type": "track", - // "userId": "123456" - // } - // ], - // "context": { - // "library": { - // "name": "analytics-go", - // "version": "2.1.0" - // } - // }, - // "messageId": "I'm unique", - // "sentAt": "2009-11-10T23:00:00+0000" - // } -} - -func ExampleTrackWithMessageIdSet() { - body, server := mockServer() - defer server.Close() - - client := New("h97jamjwbh") - client.Endpoint = server.URL - client.now = mockTime - client.uid = mockId - client.Size = 1 - - client.Track(&Track{ - Event: "Download", - UserId: "123456", - Properties: map[string]interface{}{ - "application": "Segment Desktop", - "version": "1.1.0", - "platform": "osx", - }, - Message: Message{ - MessageId: "abc", - }, - }) - - fmt.Printf("%s\n", <-body) - // Output: - // { - // "batch": [ - // { - // "event": "Download", - // "messageId": "abc", - // "properties": { - // "application": "Segment Desktop", - // "platform": "osx", - // "version": "1.1.0" - // }, - // "timestamp": "2009-11-10T23:00:00+0000", - // "type": "track", - // "userId": "123456" - // } - // ], - // "context": { - // "library": { - // "name": "analytics-go", - // "version": "2.1.0" - // } - // }, - // "messageId": "I'm unique", - // "sentAt": "2009-11-10T23:00:00+0000" - // } -} - -func ExampleTrack_context() { - body, server := mockServer() - defer server.Close() - - client := New("h97jamjwbh") - client.Endpoint = server.URL - client.now = mockTime - client.uid = mockId - client.Size = 1 - - client.Track(&Track{ - Event: "Download", - UserId: "123456", - Properties: map[string]interface{}{ - "application": "Segment Desktop", - "version": "1.1.0", - "platform": "osx", - }, - Context: map[string]interface{}{ - "whatever": "here", - }, - }) - - fmt.Printf("%s\n", <-body) - // Output: - // { - // "batch": [ - // { - // "context": { - // "whatever": "here" - // }, - // "event": "Download", - // "messageId": "I'm unique", - // "properties": { - // "application": "Segment Desktop", - // "platform": "osx", - // "version": "1.1.0" - // }, - // "timestamp": "2009-11-10T23:00:00+0000", - // "type": "track", - // "userId": "123456" - // } - // ], - // "context": { - // "library": { - // "name": "analytics-go", - // "version": "2.1.0" - // } - // }, - // "messageId": "I'm unique", - // "sentAt": "2009-11-10T23:00:00+0000" - // } -} - -func ExampleTrack_many() { - body, server := mockServer() - defer server.Close() - - client := New("h97jamjwbh") - client.Endpoint = server.URL - client.now = mockTime - client.uid = mockId - client.Size = 3 - - for i := 0; i < 5; i++ { - client.Track(&Track{ - Event: "Download", - UserId: "123456", - Properties: map[string]interface{}{ - "application": "Segment Desktop", - "version": i, - }, - }) - } - - fmt.Printf("%s\n", <-body) - // Output: - // { - // "batch": [ - // { - // "event": "Download", - // "messageId": "I'm unique", - // "properties": { - // "application": "Segment Desktop", - // "version": 0 - // }, - // "timestamp": "2009-11-10T23:00:00+0000", - // "type": "track", - // "userId": "123456" - // }, - // { - // "event": "Download", - // "messageId": "I'm unique", - // "properties": { - // "application": "Segment Desktop", - // "version": 1 - // }, - // "timestamp": "2009-11-10T23:00:00+0000", - // "type": "track", - // "userId": "123456" - // }, - // { - // "event": "Download", - // "messageId": "I'm unique", - // "properties": { - // "application": "Segment Desktop", - // "version": 2 - // }, - // "timestamp": "2009-11-10T23:00:00+0000", - // "type": "track", - // "userId": "123456" - // } - // ], - // "context": { - // "library": { - // "name": "analytics-go", - // "version": "2.1.0" - // } - // }, - // "messageId": "I'm unique", - // "sentAt": "2009-11-10T23:00:00+0000" - // } -} - -func ExampleTrackWithIntegrations() { - body, server := mockServer() - defer server.Close() - - client := New("h97jamjwbh") - client.Endpoint = server.URL - client.now = mockTime - client.uid = mockId - client.Size = 1 - - client.Track(&Track{ - Event: "Download", - UserId: "123456", - Properties: map[string]interface{}{ - "application": "Segment Desktop", - "version": "1.1.0", - "platform": "osx", - }, - Integrations: map[string]interface{}{ - "All": true, - "Intercom": false, - "Mixpanel": true, - }, - }) - - fmt.Printf("%s\n", <-body) - // Output: - // { - // "batch": [ - // { - // "event": "Download", - // "integrations": { - // "All": true, - // "Intercom": false, - // "Mixpanel": true - // }, - // "messageId": "I'm unique", - // "properties": { - // "application": "Segment Desktop", - // "platform": "osx", - // "version": "1.1.0" - // }, - // "timestamp": "2009-11-10T23:00:00+0000", - // "type": "track", - // "userId": "123456" - // } - // ], - // "context": { - // "library": { - // "name": "analytics-go", - // "version": "2.1.0" - // } - // }, - // "messageId": "I'm unique", - // "sentAt": "2009-11-10T23:00:00+0000" - // } -} - -// Tests that calling Close right after creating the client object doesn't -// block. -// Bug: https://github.com/segmentio/analytics-go/issues/43 -func TestCloseFinish(_ *testing.T) { - c := New("test") - c.Close() -} diff --git a/vendor/github.com/segmentio/analytics-go/examples/track.go b/vendor/github.com/segmentio/analytics-go/examples/track.go deleted file mode 100644 index 484c38efa..000000000 --- a/vendor/github.com/segmentio/analytics-go/examples/track.go +++ /dev/null @@ -1,36 +0,0 @@ -package main - -import "github.com/segmentio/analytics-go" -import "time" - -func main() { - client := analytics.New("h97jamjwbh") - client.Interval = 30 * time.Second - client.Size = 100 - client.Verbose = true - - done := time.After(3 * time.Second) - tick := time.Tick(50 * time.Millisecond) - -out: - for { - select { - case <-done: - println("exiting") - break out - case <-tick: - client.Track(&analytics.Track{ - Event: "Download", - UserId: "123456", - Properties: map[string]interface{}{ - "application": "Segment Desktop", - "version": "1.1.0", - "platform": "osx", - }, - }) - } - } - - println("flushing") - client.Close() -} diff --git a/vendor/github.com/segmentio/backo-go/backo_test.go b/vendor/github.com/segmentio/backo-go/backo_test.go deleted file mode 100644 index 89933acf7..000000000 --- a/vendor/github.com/segmentio/backo-go/backo_test.go +++ /dev/null @@ -1,77 +0,0 @@ -package backo - -import ( - "fmt" - "math" - "testing" - "time" - - "github.com/bmizerany/assert" -) - -// Tests default backo behaviour. -func TestDefaults(t *testing.T) { - backo := DefaultBacko() - - assert.Equal(t, milliseconds(100), backo.Duration(0)) - assert.Equal(t, milliseconds(200), backo.Duration(1)) - assert.Equal(t, milliseconds(400), backo.Duration(2)) - assert.Equal(t, milliseconds(800), backo.Duration(3)) -} - -// Tests backo does not exceed cap. -func TestCap(t *testing.T) { - backo := NewBacko(milliseconds(100), 2, 0, milliseconds(600)) - - assert.Equal(t, milliseconds(100), backo.Duration(0)) - assert.Equal(t, milliseconds(200), backo.Duration(1)) - assert.Equal(t, milliseconds(400), backo.Duration(2)) - assert.Equal(t, milliseconds(600), backo.Duration(3)) -} - -// Tests that jitter adds randomness. -func TestJitter(t *testing.T) { - defaultBacko := NewBacko(milliseconds(100), 2, 1, milliseconds(10*1000)) - jitterBacko := NewBacko(milliseconds(100), 2, 1, milliseconds(10*1000)) - - // TODO: Check jittered durations are within a range. - assert.NotEqual(t, jitterBacko.Duration(0), defaultBacko.Duration(0)) - assert.NotEqual(t, jitterBacko.Duration(1), defaultBacko.Duration(1)) - assert.NotEqual(t, jitterBacko.Duration(2), defaultBacko.Duration(2)) - assert.NotEqual(t, jitterBacko.Duration(3), defaultBacko.Duration(3)) -} - -func ExampleBacko_BackoffDefault() { - b := DefaultBacko() - ticker := b.NewTicker() - - for i := 0; i < 6; i++ { - start := time.Now() - select { - case t := <-ticker.C: - fmt.Println(nearest10Millis(t.Sub(start))) - } - } - - ticker.Stop() - - // Output: - // 100 - // 200 - // 400 - // 800 - // 1600 - // 3200 -} - -func nearest10Millis(d time.Duration) float64 { - // Typically d is something like 11 or 21, so do some magic to round the - // durations to the nearest 10. We divide d by 10, floor it, and multiply it - // by 10 again. - return math.Floor(float64(d/time.Millisecond/10) * 10) -} - -// Returns the given milliseconds as time.Duration -func milliseconds(ms int64) time.Duration { - return time.Duration(ms * 1000 * 1000) -} diff --git a/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/.gitignore b/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/.gitignore deleted file mode 100644 index b6fadf4eb..000000000 --- a/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -_go_.* -_gotest_.* -_obj -_test -_testmain.go -*.out -*.[568] diff --git a/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/README.md b/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/README.md deleted file mode 100644 index 8b6b6fc4f..000000000 --- a/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# Assert (c) Blake Mizerany and Keith Rarick -- MIT LICENCE - -## Assertions for Go tests - -## Install - - $ go get github.com/bmizerany/assert - -## Use - -**point.go** - - package point - - type Point struct { - x, y int - } - -**point_test.go** - - - package point - - import ( - "testing" - "github.com/bmizerany/assert" - ) - - func TestAsserts(t *testing.T) { - p1 := Point{1, 1} - p2 := Point{2, 1} - - assert.Equal(t, p1, p2) - } - -**output** - $ go test - --- FAIL: TestAsserts (0.00 seconds) - assert.go:15: /Users/flavio.barbosa/dev/stewie/src/point_test.go:12 - assert.go:24: ! X: 1 != 2 - FAIL - -## Docs - - http://github.com/bmizerany/assert diff --git a/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/assert.go b/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/assert.go deleted file mode 100644 index 7409f985e..000000000 --- a/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/assert.go +++ /dev/null @@ -1,76 +0,0 @@ -package assert -// Testing helpers for doozer. - -import ( - "github.com/kr/pretty" - "reflect" - "testing" - "runtime" - "fmt" -) - -func assert(t *testing.T, result bool, f func(), cd int) { - if !result { - _, file, line, _ := runtime.Caller(cd + 1) - t.Errorf("%s:%d", file, line) - f() - t.FailNow() - } -} - -func equal(t *testing.T, exp, got interface{}, cd int, args ...interface{}) { - fn := func() { - for _, desc := range pretty.Diff(exp, got) { - t.Error("!", desc) - } - if len(args) > 0 { - t.Error("!", " -", fmt.Sprint(args...)) - } - } - result := reflect.DeepEqual(exp, got) - assert(t, result, fn, cd+1) -} - -func tt(t *testing.T, result bool, cd int, args ...interface{}) { - fn := func() { - t.Errorf("! Failure") - if len(args) > 0 { - t.Error("!", " -", fmt.Sprint(args...)) - } - } - assert(t, result, fn, cd+1) -} - -func T(t *testing.T, result bool, args ...interface{}) { - tt(t, result, 1, args...) -} - -func Tf(t *testing.T, result bool, format string, args ...interface{}) { - tt(t, result, 1, fmt.Sprintf(format, args...)) -} - -func Equal(t *testing.T, exp, got interface{}, args ...interface{}) { - equal(t, exp, got, 1, args...) -} - -func Equalf(t *testing.T, exp, got interface{}, format string, args ...interface{}) { - equal(t, exp, got, 1, fmt.Sprintf(format, args...)) -} - -func NotEqual(t *testing.T, exp, got interface{}, args ...interface{}) { - fn := func() { - t.Errorf("! Unexpected: <%#v>", exp) - if len(args) > 0 { - t.Error("!", " -", fmt.Sprint(args...)) - } - } - result := !reflect.DeepEqual(exp, got) - assert(t, result, fn, 1) -} - -func Panic(t *testing.T, err interface{}, fn func()) { - defer func() { - equal(t, err, recover(), 3) - }() - fn() -} diff --git a/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/assert_test.go b/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/assert_test.go deleted file mode 100644 index 162a590c6..000000000 --- a/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/assert_test.go +++ /dev/null @@ -1,15 +0,0 @@ -package assert - -import ( - "testing" -) - -func TestLineNumbers(t *testing.T) { - Equal(t, "foo", "foo", "msg!") - //Equal(t, "foo", "bar", "this should blow up") -} - -func TestNotEqual(t *testing.T) { - NotEqual(t, "foo", "bar", "msg!") - //NotEqual(t, "foo", "foo", "this should blow up") -} diff --git a/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/example/point.go b/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/example/point.go deleted file mode 100644 index 15789fe10..000000000 --- a/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/example/point.go +++ /dev/null @@ -1,5 +0,0 @@ -package point - -type Point struct { - X, Y int -} diff --git a/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/example/point_test.go b/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/example/point_test.go deleted file mode 100644 index 34e791a43..000000000 --- a/vendor/github.com/segmentio/backo-go/vendor/github.com/bmizerany/assert/example/point_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package point - -import ( - "testing" - "assert" -) - -func TestAsserts(t *testing.T) { - p1 := Point{1, 1} - p2 := Point{2, 1} - - assert.Equal(t, p1, p2) -} -- cgit v1.2.3-1-g7c22