【发布时间】:2021-05-27 20:54:03
【问题描述】:
我正在尝试使用 MongoDB gridfs,但我是新手。我找到了使 gridfs 在 golang 中工作的在线资源,我发现了这个article。当我拿到代码并尝试运行它时,它给了我以下错误。
错误
could not import go.mongodb.org/mongo-driver/mongo/gridfs (cannot find package "go.mongodb.org/mongo-driver/mongo/gridfs" in any of
/usr/local/go/src/go.mongodb.org/mongo-driver/mongo/gridfs (from $GOROOT)
/home/bilal/go/src/go.mongodb.org/mongo-driver/mongo/gridfs (from $GOPATH))
库
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/gridfs"
"go.mongodb.org/mongo-driver/mongo/options"
这四个库给了我这个错误。但我只给出了一个错误示例。
【问题讨论】:
-
阅读并关注golang.org/doc/#getting-started,了解如何设置您的项目和使用第三方库。提示:使用模块。
标签: mongodb go go-modules