Depenancy upgrades and movign to dep. (#8630)

Этот коммит содержится в:
Christopher Speller
2018-04-16 05:37:14 -07:00
коммит произвёл Joram Wilander
родитель bf24f51c4e
Коммит 6e2cb00008
5345 изменённых файлов: 17051 добавлений и 1634753 удалений

17
vendor/github.com/segmentio/analytics-go/Godeps/Godeps.json сгенерированный поставляемый
Просмотреть файл

@@ -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"
}
]
}

5
vendor/github.com/segmentio/analytics-go/Godeps/Readme сгенерированный поставляемый
Просмотреть файл

@@ -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.

2
vendor/github.com/segmentio/analytics-go/Godeps/_workspace/.gitignore сгенерированный поставляемый
Просмотреть файл

@@ -1,2 +0,0 @@
/pkg
/bin

Просмотреть файл

@@ -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

Просмотреть файл

@@ -1,4 +0,0 @@
go-strftime
===========
go implementation of strftime

Просмотреть файл

@@ -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)
}

Просмотреть файл

@@ -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()
}
}

204
vendor/github.com/segmentio/analytics-go/Godeps/_workspace/src/github.com/xtgo/uuid/uuid.go сгенерированный поставляемый
Просмотреть файл

@@ -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))
}

Просмотреть файл

@@ -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
}
}

478
vendor/github.com/segmentio/analytics-go/analytics_test.go сгенерированный поставляемый
Просмотреть файл

@@ -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()
}

36
vendor/github.com/segmentio/analytics-go/examples/track.go сгенерированный поставляемый
Просмотреть файл

@@ -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()
}