解决办法
这里的是Windows的环境下的解决办法
在GOPATH的src目录下面创建github.com\golang文件夹,若文件夹存请忽略本步骤
在vs code终端执行: cd %GOPATH%\src\github.com\golang 这里的%GOPATH%就是GOPATH
完成目录切换后,开始下载插件包:git clone https://github.com/golang/tools.git tools
当下载完成后,你会发现%GOPATH%\src\github.com\golang多了一个tools目录
需要把tools目录下的所有文件拷贝到%GOPATH%\src\golang.org\x\tools下,如果没有x\tools自行创建
go install github.com/nsf/gocode go install github.com/uudashr/gopkgs/cmd/gopkgs 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/fatih/gomodifytags go install github.com/haya14busa/goplay/cmd/goplay go install github.com/josharian/impl go install github.com/rogpeppe/godef go install sourcegraph.com/sqs/goreturns go install github.com/golang/lint/golint go install github.com/cweill/gotests/... go install github.com/derekparker/delve/cmd/dlv
在这里基本已经可以结束了,但是由于有些包在vscode自动安装的时候并没有下载成功,会出现以下错误:
解决办法:
切换到%GOPATH%/src/github.com目录下执行git clone https://github.com/nsf/gocode
,就是提示哪个无法找到就执行就可以了,然后再切换到%GOPATH%目录下继续执行要安装的插件即可。
手动安装 go get -u -v github.com/ramya-rao-a/go-outline go get -u -v github.com/acroca/go-symbols go get -u -v github.com/mdempsky/gocode go get -u -v github.com/rogpeppe/godef go get -u -v golang.org/x/tools/cmd/godoc go get -u -v github.com/zmb3/gogetdoc go get -u -v github.com/golang/lint/golint go get -u -v github.com/fatih/gomodifytags go get -u -v golang.org/x/tools/cmd/gorename go get -u -v sourcegraph.com/sqs/goreturns go get -u -v golang.org/x/tools/cmd/goimports go get -u -v github.com/cweill/gotests/... go get -u -v golang.org/x/tools/cmd/guru go get -u -v github.com/josharian/impl go get -u -v github.com/haya14busa/goplay/cmd/goplay go get -u -v github.com/uudashr/gopkgs/cmd/gopkgs go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct go get -u -v github.com/alecthomas/gometalinter gometalinter --install
cd %GOPATH%/src/github.com git clone https://