为什么 Go-get 让我选择一个分支?

Why does Go-get ask me to pick a branch?

我想安装 mongoDB-驱动程序。当我输入这个命令时

go get go.mongodb.org/mongo-driver/mongo

我得到了:

    #  cd /Users/jiangwei/go/src/go.mongodb.org/mongo-driver; git pull --ff-only
    There is no tracking information for the current branch.
    Please specify which branch you want to merge with.
    See git-pull(1) for details.

    git pull <remote> <branch>

    If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master

    package go.mongodb.org/mongo-driver/mongo: exit status 1

可能是因为您已经将该回购检出到您的 Go 路径中,并且已更改为 non-default 分支。更正它的最简单方法是删除该存储库,然后从头开始。

rm -rf $(go env GOPATH)/src/go.mongodb.org/mongo-driver

当然,这会丢失您在该存储库中所做的任何更改。