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?
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"