gpt4 book ai didi

mongodb - 无法安装最新版本的mongo-go-driver(v1.2.1)

转载 作者:行者123 更新时间:2023-12-01 22:26:33 25 4
gpt4 key购买 nike

我无法获得mongo-go-driver v1.2.1。我正在使用dep来解决依赖关系。
我的导入块看起来像-

import (
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/bson"

"fmt"
"context"
)

当我运行 dep ensure -v时,我得到以下输出
(50)  ✗   github.com/mongodb/mongo-go-driver at v1.2.1 has problem subpkg(s):
(50) github.com/mongodb/mongo-go-driver/bson/objectid is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/private/cluster is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/readpref has err (*pkgtree.NonCanonicalImportRoot); required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/writeconcern has err (*pkgtree.NonCanonicalImportRoot); required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/bson has err (*pkgtree.NonCanonicalImportRoot); required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/bson/decimal is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/bson/elements is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/connstring is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/options has err (*pkgtree.NonCanonicalImportRoot); required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/private/ops is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/readconcern has err (*pkgtree.NonCanonicalImportRoot); required by go.mongodb.org/mongo-driver@v0.0.1.
(49) try github.com/mongodb/mongo-go-driver@v1.2.0
(50) ✗ github.com/mongodb/mongo-go-driver at v1.2.0 has problem subpkg(s):
(50) github.com/mongodb/mongo-go-driver/bson/objectid is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/options has err (*pkgtree.NonCanonicalImportRoot); required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/readconcern has err (*pkgtree.NonCanonicalImportRoot); required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/bson/elements is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/bson/decimal is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/connstring is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/private/cluster is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/private/ops is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/readpref has err (*pkgtree.NonCanonicalImportRoot); required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/writeconcern has err (*pkgtree.NonCanonicalImportRoot); required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/bson has err (*pkgtree.NonCanonicalImportRoot); required by go.mongodb.org/mongo-driver@v0.0.1.
(49) try github.com/mongodb/mongo-go-driver@v1.1.4
(50) ✗ github.com/mongodb/mongo-go-driver at v1.1.4 has problem subpkg(s):
(50) github.com/mongodb/mongo-go-driver/mongo/private/cluster is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/private/ops is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/readconcern has err (*pkgtree.NonCanonicalImportRoot); required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/readpref has err (*pkgtree.NonCanonicalImportRoot); required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/writeconcern has err (*pkgtree.NonCanonicalImportRoot); required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/connstring is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/bson/decimal is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/bson/elements is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/bson/objectid is missing; required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/mongo/options has err (*pkgtree.NonCanonicalImportRoot); required by go.mongodb.org/mongo-driver@v0.0.1. github.com/mongodb/mongo-go-driver/bson has err (*pkgtree.NonCanonicalImportRoot); required by go.mongodb.org/mongo-driver@v0.0.1.

.
.
.


(49) try github.com/mongodb/mongo-go-driver@v0.0.2
(50) ✗ github.com/mongodb/mongo-go-driver at v0.0.2 has problem subpkg(s):
(50) github.com/mongodb/mongo-go-driver/mongo/options is missing; required by go.mongodb.org/mongo-driver@v0.0.1.
(49) try github.com/mongodb/mongo-go-driver@v0.0.1
(49) ✓ select github.com/mongodb/mongo-go-driver@v0.0.1 w/20 pkgs

并且最后导入v.0.0.1。请帮忙。

最佳答案

我解决了。这是面临此问题的其他任何人的解决方案。
将以下行添加到Gopkg.toml

[[constraint]]
name = "go.mongodb.org/mongo-driver"
version = "~1.2.0"

您可以将版本值替换为所需的版本。

关于mongodb - 无法安装最新版本的mongo-go-driver(v1.2.1),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59681354/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com