运行一个 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"
}
}
在 Windows 上,需要运行下面命令:
PowerShell
复制
$env:GO111MODULE="on"
$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
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。