新手用VSCode写GO会遇到的问题
1.VScode安装go插件报错。
这个问题据笔者查询发现是个bug,科学上网也无法下载,安装插件会报错如下:
Installing github.com/cweill/gotests/... FAILED
Installing github.com/derekparker/delve/cmd/dlv SUCCEEDED
8 tools failed to install.
go-outline:
Error: Command failed: D:\Go\bin\go.exe get -u -v github.com/ramya-rao-a/go-outline
github.com/ramya-rao-a/go-outline (download)
Fetching https://golang.org/x/tools/go/buildutil?go-get=1
https fetch failed: Get https://golang.org/x/tools/go/buildutil?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
解决如下:
以windows为例,
在cmd 窗口中执行下列语句
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct
这里https://goproxy.io是一个国内的代理&#x