解决vscode中安装go tools和golint失败的问题

到github下载go tools 和 golint 的源码到本地目录,用go install 命令安装即可

1、在%GOPATH%\src\ 目录下,建立golang.org 文件夹,并再新建x文件夹。 目录为 “%GOPATH\src\golang.org\x\”
2、完成目录切换后,开始下载插件包:git clone https://github.com/golang/tools.git tools
3、执行完以后,会多一个tools文件夹。
4、打开vsCode终端,切换到 终端,进入“%GOPATH”目录,执行

具体方法

go install github.com/ramya-rao-a/go-outline
go install github.com/acroca/go-symbols
go install golang.org/x/tools/cmd/guru
go install golang.org/x/tools/cmd/gorename
go install github.com/josharian/impl
go install github.com/rogpeppe/godef
go install github.com/sqs/goreturns
go install github.com/golang/lint/golint
go install github.com/cweill/gotests/gotests
go install github.com/ramya-rao-a/go-outline
go install github.com/acroca/go-symbols
go install golang.org/x/tools/cmd/guru
go install golang.org/x/tools/cmd/gorename
go install github.com/josharian/impl
go install github.com/rogpeppe/godef
go install github.com/sqs/goreturns
go install github.com/cweill/gotests/gotests

 

继续安装golint
在cmd中切换到“GOPATH”目录,执行 git clone https://github.com/golang/lint.git

将glint也下载到本地
复制%GOPATH%\src\github.com\golang\lint目录到%GOPATH%\src\golang.org\x,不复制源码不同意,算了,复制
执行:go install golang.org\x\lint\golint,安装完毕
至此,全部go插件都安装完毕,重启vscode,看效果,不会有提示再弹出了

发表回复