【问题标题】:403 forbidden when downloading mongoDB driver for golang为 golang 下载 mongoDB 驱动程序时禁止 403
【发布时间】:2022-01-16 18:24:15
【问题描述】:

我正在尝试将 mongoDB golang 驱动程序下载到在 VS 代码终端中运行此命令的 VS 代码项目中:

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

但我收到这样的 403 禁止错误:

go: downloading github.com/klauspost/compress v1.13.6
go.mongodb.org/mongo-driver/mongo imports
       github.com/klauspost/compress/zstd: github.com/klauspost/compress@v1.13.6: reading https://proxy.golang.org/github.com/klauspost/compress/@v/v1.13.6.zip: 403 Forbidden

我认为我的 IP 地址可能受到限制,因此我尝试使用 psiphon 和热点盾等几个 VPN 下载它,但我仍然遇到同样的错误。

【问题讨论】:

    标签: mongodb go visual-studio-code http-status-code-403


    【解决方案1】:

    您可以通过以下方式暂时跳过使用 GOPROXY:

    GORPOXY='direct' go get YOUR_URL
    

    这样,它会跳过 goproxy 检查并直接从提供的目的地下载您的 repo。

    【讨论】:

    • 尝试在 VS 代码终端中运行此命令时出现此错误:The term 'GORPOXY=direct' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 我应该下载一些东西以便使用 GOPROXY 吗?
    • GOPROXY=direct 是一个环境。它不是命令。你在哪里运行你的命令?在任何地方,你都需要通过设置这个环境来测试它。
    • 我是 golang 新手,你能告诉我如何在 GOPROXY 的值等于 direct 的情况下运行 go get 命令
    猜你喜欢
    • 2023-01-27
    • 2020-02-02
    • 2014-02-20
    • 2021-02-09
    • 2014-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-13
    相关资源
    最近更新 更多