英文:
error installing go debugger go-delve io timeout
问题
我正在尝试从这篇文章中安装一个Go调试器:https://blog.jetbrains.com/go/2020/05/06/debugging-a-go-application-inside-a-docker-container/
我在Docker文件中添加了以下行:
RUN go install github.com/go-delve/delve/cmd/dlv@latest
但是一直出现超时错误:
=> ERROR [build-env 2/5] RUN go install github.com/go-delve/delve/cmd/dlv@latest
30.6s
------
> [build-env 2/5] RUN go install github.com/go-delve/delve/cmd/dlv@latest:
#7 30.56 go install github.com/go-delve/delve/cmd/dlv@latest: module github.com/go-delve/delve/cmd/dlv: Get "https://proxy.golang.org/github.com/go-delve/delve/cmd/dlv/@v/list": dial tcp 172.217.168.209:443: i/o timeout
------
executor failed running [/bin/sh -c go install github.com/go-delve/delve/cmd/dlv@latest]: exit code: 1
make: *** [build-func] Error 1
当我尝试在浏览器中访问该URL时:
https://proxy.golang.org/github.com/go-delve/delve/cmd/dlv/@v/list
显示未找到:module github.com/go-delve/delve/cmd/dlv: no matching versions for query "latest"
这里发生了什么?
英文:
I am trying to install a go debugger from this post
https://blog.jetbrains.com/go/2020/05/06/debugging-a-go-application-inside-a-docker-container/
and I added this line to docker file
RUN go install github.com/go-delve/delve/cmd/dlv@latest
but it keeps on getting a timeout error
=> ERROR [build-env 2/5] RUN go install github.com/go-delve/delve/cmd/dlv@latest
30.6s
------
> [build-env 2/5] RUN go install github.com/go-delve/delve/cmd/dlv@latest:
#7 30.56 go install github.com/go-delve/delve/cmd/dlv@latest: module github.com/go-delve/delve/cmd/dlv: Get "https://proxy.golang.org/github.com/go-delve/delve/cmd/dlv/@v/list": dial tcp 172.217.168.209:443: i/o timeout
------
executor failed running [/bin/sh -c go install github.com/go-delve/delve/cmd/dlv@latest]: exit code: 1
make: *** [build-func] Error 1
when I try to visit that url in the browser
https://proxy.golang.org/github.com/go-delve/delve/cmd/dlv/@v/list
not found: module github.com/go-delve/delve/cmd/dlv: no matching versions for query "latest"
what is going on here?
答案1
得分: 3
在中国,你可以设置GOPROXY="https://goproxy.cn"
。
在Dockerfile中,在go install
之前添加以下行:
ENV GOPROXY="https://goproxy.cn"
如果你使用https://goproxy.cn
作为你的go proxy
:
ENV GOPROXY="https://goproxy.cn"
英文:
Set GOPROXY="${some proxy}"
, in China you can set like GOPROXY="https://goproxy.cn"
In Dockerfile, add this line before the go install
:
ENV GOPROXY="${some proxy}"
If you use https://goproxy.cn
as your go proxy
:
ENV GOPROXY="https://goproxy.cn"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论