由于依赖的go包都是外部的,有些在国内无法访问,造成安装失败。
Installing github.com/mdempsky/gocode FAILED
Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs FAILED
Installing github.com/ramya-rao-a/go-outline FAILED
Installing github.com/acroca/go-symbols FAILED
Installing golang.org/x/tools/cmd/guru FAILED
Installing golang.org/x/tools/cmd/gorename FAILED
Installing github.com/cweill/gotests/… FAILED
Installing github.com/fatih/gomodifytags FAILED
Installing github.com/josharian/impl FAILED
Installing github.com/davidrjenni/reftools/cmd/fillstruct FAILED
Installing github.com/haya14busa/goplay/cmd/goplay FAILED
Installing github.com/godoctor/godoctor FAILED
Installing github.com/go-delve/delve/cmd/dlv FAILED
Installing github.com/stamblerre/gocode FAILED
Installing github.com/rogpeppe/godef FAILED
Installing github.com/sqs/goreturns FAILED
Installing golang.org/x/lint/golint FAILED
这种情况下,需要配置代理,在命令行执行如下命令以配置https://goproxy.io代理:
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct
重新打开vscode,安装所有依赖的go包即可SUCCEEDED。
gopkgs
go-outline
impl
goplay
dlv
dlv-dap
staticcheck
gopls
Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs SUCCEEDED
Installing github.com/ramya-rao-a/go-outline SUCCEEDED
Installing github.com/josharian/impl SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv@v1.7.1-0.20210804080032-f95340ae1bf9 SUCCEEDED
Installing honnef.co/go/tools/cmd/staticcheck SUCCEEDED
Installing golang.org/x/tools/gopls SUCCEEDED
All tools successfully installed. You are ready to Go :).