开发者社区> 问答> 正文

运行一个 go 的 demo 报错了,这个是环境没有配置好吗?

运行一个 go 的 demo 报错了,这个是环境没有配置好吗?
正文:

connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.\n"
}
Installing github.com/josharian/impl@v1.1.0 FAILED
{
 "killed": false,
 "code": 1,
 "signal": null,
 "cmd": "F:\\Program Files\\Go\\bin\\go.exe install -v github.com/josharian/impl@v1.1.0",
 "stdout": "",
 "stderr": "go: downloading github.com/josharian/impl v1.1.0\ngo: github.com/josharian/impl@v1.1.0: github.com/josharian/impl@v1.1.0: verifying module: github.com/josharian/impl@v1.1.0: Get \"https://sum.golang.org/lookup/github.com/josharian/impl@v1.1.0\": dial tcp [2404:6800:4012:2::2011]:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.\n"
}
Installing github.com/haya14busa/goplay/cmd/goplay@v1.0.0 FAILED
{
 "killed": false,
 "code": 1,
 "signal": null,
 "cmd": "F:\\Program Files\\Go\\bin\\go.exe install -v github.com/haya14busa/goplay/cmd/goplay@v1.0.0",
 "stdout": "",
 "stderr": "go: downloading github.com/haya14busa/goplay v1.0.0\ngo: github.com/haya14busa/goplay/cmd/goplay@v1.0.0: github.com/haya14busa/goplay@v1.0.0: verifying module: github.com/haya14busa/goplay@v1.0.0: Get \"https://sum.golang.org/lookup/github.com/haya14busa/goplay@v1.0.0\": dial tcp [2404:6800:4012:2::2011]:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.\n"
}
}

展开
收起
OSC开源社区 2024-05-31 15:38:05 43 0
1 条回答
写回答
取消 提交回答
  • 在 Windows 上,需要运行下面命令:

    PowerShell
    复制

    启用 Go Modules 功能

    $env:GO111MODULE="on"

    配置 GOPROXY 环境变量

    $env:GOPROXY="https://goproxy.io"
    现在,当你构建或运行你的应用时,Go 将会通过 goproxy.io 获取依赖。更多信息请查看 goproxy 仓库。

    如果你使用的 Go 版本>=1.13, 你可以通过设置 GOPRIVATE 环境变量来控制哪些私有仓库和依赖(公司内部仓库)不通过 proxy 来拉取,直接走本地,设置如下:

    Go version >= 1.13
    复制
    go env -w GOPROXY=https://goproxy.io,direct
    设置不走 proxy 的私有仓库,多个用逗号相隔
    go env -w GOPRIVATE=*.corp.example.com

    2024-05-31 16:34:08
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Go语言路上踩过的坑 立即下载
gohbase :HBase go客户端 立即下载
Go构建日请求千亿级微服务实践 立即下载