参考 goproxy.io ,打开 cmd ,输入
go env -w GOPROXY=https://goproxy.io,direct
后续的 go 命令将从公共代理镜像中快速拉取所需的依赖代码了;
重启 VSCode,打开任意一个 go 文件,保存,右下角会提示安装依赖,选择安装全部;
等待安装完成,在OUTPUT窗口会有相应的信息输出
Tools environment: GOPATH=D:\goproject
Installing 9 tools at D:\goproject\bin in module mode.
gopkgs
go-outline
gotests
gomodifytags
impl
goplay
dlv
golint
gopls
Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs (D:\goproject\bin\gopkgs.exe) SUCCEEDED
Installing github.com/ramya-rao-a/go-outline (D:\goproject\bin\go-outline.exe) SUCCEEDED
Installing github.com/cweill/gotests/... (D:\goproject\bin\gotests.exe) SUCCEEDED
Installing github.com/fatih/gomodifytags (D:\goproject\bin\gomodifytags.exe) SUCCEEDED
Installing github.com/josharian/impl (D:\goproject\bin\impl.exe) SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay (D:\goproject\bin\goplay.exe) SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv (D:\goproject\bin\dlv.exe) SUCCEEDED
Installing golang.org/x/lint/golint (D:\goproject\bin\golint.exe) SUCCEEDED
Installing golang.org/x/tools/gopls (D:\goproject\bin\gopls.exe) SUCCEEDED
All tools successfully installed. You are ready to Go :).
转载:https://blog.csdn.net/xtho62/article/details/114108767
查看评论