I'm trying to use the mgo driver. I run
go get gopkg.in/mgo.v2
To get the package, but get these errors -
# gopkg.in/mgo.v2/internal/scram
/usr/local/go/src/pkg/gopkg.in/mgo.v2/internal/scram/scram.go:86: c.out.Grow undefined (type bytes.Buffer has no field or method Grow)
/usr/local/go/src/pkg/gopkg.in/mgo.v2/internal/scram/scram.go:87: c.authMsg.Grow undefined (type bytes.Buffer has no field or method Grow)
# gopkg.in/mgo.v2/bson
/usr/local/go/src/pkg/gopkg.in/mgo.v2/bson/decode.go:246: k.Convert undefined (type reflect.Value has no field or method Convert)
/usr/local/go/src/pkg/gopkg.in/mgo.v2/bson/encode.go:56: undefined: json.Number
/usr/local/go/src/pkg/gopkg.in/mgo.v2/bson/encode.go:282: undefined: json.Number
Should I be doing something else?
Based on the error messages, I suspect that you are running Go 1. Run go version
to confirm.
If you are running Go 1, then you will need to upgrade to a newer version of Go. I recommend installing the most recent official binary from golang.org. At the time that I am writing this, the most recent version is 1.4.1.
Update Go to the latest version by going to https://golang.org/dl/. In case you worry about uninstallation of Go, all you need to do is delete the Go folder, that's it. This will most probably solve the problem. But if the problem persists, then send me the screenshot of the errors.