英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论