安装Go调试器go-delve时出现错误,IO超时。

huangapple go评论80阅读模式
英文:

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"

huangapple
  • 本文由 发表于 2022年9月21日 03:54:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/73791984.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定