Skip to content

Commit

Permalink
Move package to gopkg.in.
Browse files Browse the repository at this point in the history
  • Loading branch information
niemeyer committed Jul 16, 2014
1 parent 2e26580 commit d1fb2c3
Show file tree
Hide file tree
Showing 23 changed files with 80 additions and 67 deletions.
3 changes: 2 additions & 1 deletion auth.go
Expand Up @@ -31,8 +31,9 @@ import (
"encoding/hex"
"errors"
"fmt"
"labix.org/v2/mgo/bson"
"sync"

"gopkg.in/mgo.v2/bson"
)

type authCmd struct {
Expand Down
11 changes: 6 additions & 5 deletions auth_test.go
Expand Up @@ -29,11 +29,12 @@ package mgo_test
import (
"flag"
"fmt"
"labix.org/v2/mgo"
. "launchpad.net/gocheck"
"net/url"
"sync"
"time"

. "gopkg.in/check.v1"
"gopkg.in/mgo.v2"
)

func (s *S) TestAuthLoginDatabase(c *C) {
Expand Down Expand Up @@ -848,9 +849,9 @@ func (s *S) TestAuthPlainCred(c *C) {
c.Skip("no -plain")
}
cred := &mgo.Credential{
Username: plainUser,
Password: plainPass,
Source: "$external",
Username: plainUser,
Password: plainPass,
Source: "$external",
Mechanism: "PLAIN",
}
c.Logf("Connecting to %s...", *plainFlag)
Expand Down
5 changes: 3 additions & 2 deletions bson/bson_test.go
Expand Up @@ -31,12 +31,13 @@ import (
"encoding/binary"
"encoding/json"
"errors"
"labix.org/v2/mgo/bson"
. "launchpad.net/gocheck"
"net/url"
"reflect"
"testing"
"time"

. "gopkg.in/check.v1"
"gopkg.in/mgo.v2/bson"
)

func TestAll(t *testing.T) {
Expand Down
14 changes: 9 additions & 5 deletions bulk_test.go
Expand Up @@ -27,8 +27,8 @@
package mgo_test

import (
"labix.org/v2/mgo"
. "launchpad.net/gocheck"
. "gopkg.in/check.v1"
"gopkg.in/mgo.v2"
)

func (s *S) TestBulkInsert(c *C) {
Expand All @@ -44,7 +44,7 @@ func (s *S) TestBulkInsert(c *C) {
c.Assert(err, IsNil)
c.Assert(r, FitsTypeOf, &mgo.BulkResult{})

type doc struct{ N int }
type doc struct{ N int }
var res []doc
err = coll.Find(nil).Sort("n").All(&res)
c.Assert(err, IsNil)
Expand All @@ -62,7 +62,9 @@ func (s *S) TestBulkInsertError(c *C) {
_, err = bulk.Run()
c.Assert(err, ErrorMatches, ".*duplicate key.*")

type doc struct{ N int `_id` }
type doc struct {
N int `_id`
}
var res []doc
err = coll.Find(nil).Sort("_id").All(&res)
c.Assert(err, IsNil)
Expand All @@ -81,7 +83,9 @@ func (s *S) TestBulkInsertErrorUnordered(c *C) {
_, err = bulk.Run()
c.Assert(err, ErrorMatches, ".*duplicate key.*")

type doc struct{ N int `_id` }
type doc struct {
N int `_id`
}
var res []doc
err = coll.Find(nil).Sort("_id").All(&res)
c.Assert(err, IsNil)
Expand Down
3 changes: 2 additions & 1 deletion cluster.go
Expand Up @@ -28,10 +28,11 @@ package mgo

import (
"errors"
"labix.org/v2/mgo/bson"
"net"
"sync"
"time"

"gopkg.in/mgo.v2/bson"
)

// ---------------------------------------------------------------------------
Expand Down
7 changes: 4 additions & 3 deletions cluster_test.go
Expand Up @@ -29,13 +29,14 @@ package mgo_test
import (
"fmt"
"io"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
. "launchpad.net/gocheck"
"net"
"strings"
"sync"
"time"

. "gopkg.in/check.v1"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func (s *S) TestNewSession(c *C) {
Expand Down
3 changes: 2 additions & 1 deletion gridfs.go
Expand Up @@ -32,10 +32,11 @@ import (
"errors"
"hash"
"io"
"labix.org/v2/mgo/bson"
"os"
"sync"
"time"

"gopkg.in/mgo.v2/bson"
)

type GridFS struct {
Expand Down
7 changes: 4 additions & 3 deletions gridfs_test.go
Expand Up @@ -28,11 +28,12 @@ package mgo_test

import (
"io"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
. "launchpad.net/gocheck"
"os"
"time"

"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
. "gopkg.in/check.v1"
)

func (s *S) TestGridFSCreate(c *C) {
Expand Down
19 changes: 8 additions & 11 deletions queue_test.go
Expand Up @@ -27,21 +27,21 @@
package mgo

import (
"launchpad.net/gocheck"
. "gopkg.in/check.v1"
)

type QS struct{}

var _ = gocheck.Suite(&QS{})
var _ = Suite(&QS{})

func (s *QS) TestSequentialGrowth(c *gocheck.C) {
func (s *QS) TestSequentialGrowth(c *C) {
q := queue{}
n := 2048
for i := 0; i != n; i++ {
q.Push(i)
}
for i := 0; i != n; i++ {
c.Assert(q.Pop(), gocheck.Equals, i)
c.Assert(q.Pop(), Equals, i)
}
}

Expand All @@ -61,7 +61,7 @@ var queueTestLists = [][]int{
0, 1, 2, 3, 4, 5, 6, 7, 8},
}

func (s *QS) TestQueueTestLists(c *gocheck.C) {
func (s *QS) TestQueueTestLists(c *C) {
test := []int{}
testi := 0
reset := func() {
Expand All @@ -85,20 +85,17 @@ func (s *QS) TestQueueTestLists(c *gocheck.C) {
q := queue{}
for _, n := range list {
if n == -1 {
c.Assert(q.Pop(), gocheck.Equals, pop(),
gocheck.Commentf("With list %#v", list))
c.Assert(q.Pop(), Equals, pop(), Commentf("With list %#v", list))
} else {
q.Push(n)
push(n)
}
}

for n := pop(); n != -1; n = pop() {
c.Assert(q.Pop(), gocheck.Equals, n,
gocheck.Commentf("With list %#v", list))
c.Assert(q.Pop(), Equals, n, Commentf("With list %#v", list))
}

c.Assert(q.Pop(), gocheck.Equals, nil,
gocheck.Commentf("With list %#v", list))
c.Assert(q.Pop(), Equals, nil, Commentf("With list %#v", list))
}
}
2 changes: 1 addition & 1 deletion saslimpl.go
Expand Up @@ -3,7 +3,7 @@
package mgo

import (
"labix.org/v2/mgo/sasl"
"gopkg.in/mgo.v2/sasl"
)

func saslNew(cred Credential, host string) (saslStepper, error) {
Expand Down
3 changes: 2 additions & 1 deletion server.go
Expand Up @@ -28,11 +28,12 @@ package mgo

import (
"errors"
"labix.org/v2/mgo/bson"
"net"
"sort"
"sync"
"time"

"gopkg.in/mgo.v2/bson"
)

// ---------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions session.go
Expand Up @@ -31,7 +31,6 @@ import (
"encoding/hex"
"errors"
"fmt"
"labix.org/v2/mgo/bson"
"math"
"net"
"net/url"
Expand All @@ -41,6 +40,8 @@ import (
"strings"
"sync"
"time"

"gopkg.in/mgo.v2/bson"
)

type mode int
Expand Down Expand Up @@ -2278,7 +2279,6 @@ func checkQueryError(fullname string, d []byte) error {
Error:
result := &queryError{}
bson.Unmarshal(d, result)
logf("queryError: %#v\n", result)
if result.LastError != nil {
return result.LastError
}
Expand Down
9 changes: 5 additions & 4 deletions session_test.go
Expand Up @@ -29,16 +29,17 @@ package mgo_test
import (
"flag"
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
. "launchpad.net/gocheck"
"math"
"reflect"
"runtime"
"sort"
"strconv"
"strings"
"time"

. "gopkg.in/check.v1"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func (s *S) TestRunString(c *C) {
Expand Down Expand Up @@ -764,7 +765,7 @@ func (s *S) TestIsDupValues(c *C) {
c.Assert(mgo.IsDup(&mgo.QueryError{Code: 11001}), Equals, true)
c.Assert(mgo.IsDup(&mgo.LastError{Code: 12582}), Equals, true)
c.Assert(mgo.IsDup(&mgo.QueryError{Code: 12582}), Equals, true)
lerr := &mgo.LastError{Code: 16460, Err:"error inserting 1 documents to shard ... caused by :: E11000 duplicate key error index: ..."}
lerr := &mgo.LastError{Code: 16460, Err: "error inserting 1 documents to shard ... caused by :: E11000 duplicate key error index: ..."}
c.Assert(mgo.IsDup(lerr), Equals, true)
}

Expand Down
3 changes: 2 additions & 1 deletion socket.go
Expand Up @@ -28,10 +28,11 @@ package mgo

import (
"errors"
"labix.org/v2/mgo/bson"
"net"
"sync"
"time"

"gopkg.in/mgo.v2/bson"
)

type replyFunc func(err error, reply *replyOp, docNum int, docData []byte)
Expand Down
8 changes: 4 additions & 4 deletions suite_test.go
Expand Up @@ -30,16 +30,16 @@ import (
"errors"
"flag"
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
. "launchpad.net/gocheck"
"net"
"os/exec"
"strconv"
"syscall"

"testing"
"time"

. "gopkg.in/check.v1"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

var fast = flag.Bool("fast", false, "Skip slow tests")
Expand Down
3 changes: 2 additions & 1 deletion txn/debug.go
Expand Up @@ -3,9 +3,10 @@ package txn
import (
"bytes"
"fmt"
"labix.org/v2/mgo/bson"
"sort"
"sync/atomic"

"gopkg.in/mgo.v2/bson"
)

var (
Expand Down
13 changes: 7 additions & 6 deletions txn/flusher.go
Expand Up @@ -2,9 +2,10 @@ package txn

import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"sort"

"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func flush(r *Runner, t *transaction) error {
Expand Down Expand Up @@ -357,11 +358,11 @@ NextDoc:
drevno := revno[dkey]
switch {
case op.Insert != nil && drevno < 0:
revno[dkey] = -drevno+1
revno[dkey] = -drevno + 1
case op.Update != nil && drevno >= 0:
revno[dkey] = drevno+1
revno[dkey] = drevno + 1
case op.Remove && drevno >= 0:
revno[dkey] = -drevno-1
revno[dkey] = -drevno - 1
}
}
if !prereqs {
Expand Down Expand Up @@ -745,7 +746,7 @@ func (f *flusher) apply(t *transaction, pull map[bson.ObjectId]*transaction) err
case op.Update != nil:
if revno < 0 {
err = mgo.ErrNotFound
f.debugf("Won't try to apply update op; negative revision means the document is missing or stashed");
f.debugf("Won't try to apply update op; negative revision means the document is missing or stashed")
} else {
newRevno := revno + 1
logRevnos[i] = newRevno
Expand Down
4 changes: 2 additions & 2 deletions txn/mgo_test.go
Expand Up @@ -2,8 +2,8 @@ package txn_test

import (
"bytes"
"labix.org/v2/mgo"
. "launchpad.net/gocheck"
"gopkg.in/mgo.v2"
. "gopkg.in/check.v1"
"os/exec"
"time"
)
Expand Down

0 comments on commit d1fb2c3

Please sign in to comment.