导入mgo驱动程序时出错

huangapple go评论77阅读模式
英文:

Error importing mgo driver

问题

我正在尝试使用mgo驱动程序。我运行以下命令来获取包:

go get gopkg.in/mgo.v2

但是出现了以下错误:

# 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

我应该做些其他的事情吗?

英文:

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?

答案1

得分: 1

更新Go语言到最新版本,请访问https://golang.org/dl/。如果你担心卸载Go语言会有问题,你只需要删除Go文件夹即可,就这样。这很可能会解决问题。但如果问题仍然存在,请将错误的截图发送给我。

英文:

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.

huangapple
  • 本文由 发表于 2015年2月9日 05:57:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/28399837.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定