由于被墙的原因,VSCode配置go开发环境时,总是提示插件安装失败,现给出自己写的命令文件,执行后,即可正确安装对应的插件。
首先要配置好GOPATH。
- 下载插件
mkdir -vp $GOPATH/src/golang.org/x
cd $GOPATH/src/golang.org/x
git clone https://github.com/golang/tools
git clone https://github.com/golang/lint
git clone https://github.com/golang/mod
git clone https://github.com/golang/xerrors
mkdir -vp $GOPATH/src/github.com
cd $GOPATH/src/github.com
mkdir -vp mdempsky/gocode
git clone https://github.com/mdempsky/gocode ./mdempsky/gocode
mkdir -vp karrick/godirwalk
git clone https://github.com/karrick/godirwalk ./karrick/godirwalk
mkdir -vp pkg/errors
git clone https://github.com/pkg/errors ./pkg/errors
mkdir -vp uudashr/gopkgs
git clone https://github.com/uudashr/gopkgs ./uudashr/gopkgs
mkdir -vp ramya-rao-a/go-outline
git clone https://github.com/ramya-rao-a/go-outline ./ramya-rao-a/go-outline
mkdir -vp acroca/go-symbols
git clone https://github.com/acroca/go-symbols ./acroca/go-symbols
mkdir -vp go-delve/delve
git clone https://github.com/go-delve/delve ./go-delve/delve
mkdir -vp stamblerre/gocode
git clone https://github.com/stamblerre/gocode ./stamblerre/gocode
mkdir -vp rogpeppe/godef
git clone https://github.com/rogpeppe/godef ./rogpeppe/godef
mkdir -vp sqs/goreturns
git clone https://github.com/sqs/goreturns ./sqs/goreturns
mkdir -vp cweill/gotests
git clone https://github.com/cweill/gotests ./cweill/gotests
mkdir -vp fatih/gomodifytags
git clone https://github.com/fatih/gomodifytags ./fatih/gomodifytags
mkdir -vp josharian/impl
git clone https://github.com/josharian/impl ./josharian/impl
mkdir -vp davidrjenni/reftools
git clone https://github.com/davidrjenni/reftools ./davidrjenni/reftools
mkdir -vp skratchdot/open-golang
git clone https://github.com/skratchdot/open-golang ./skratchdot/open-golang
mkdir -vp haya14busa/goplay
git clone https://github.com/haya14busa/goplay ./haya14busa/goplay
mkdir -vp godoctor/godoctor
git clone https://github.com/godoctor/godoctor ./godoctor/godoctor
- 安装插件
cd $GOPATH/src
echo "1.install gocode"
go install github.com/mdempsky/gocode
echo "2.install gopkgs"
go install github.com/uudashr/gopkgs/v2/cmd/gopkgs
echo "3.install go-outline"
go install github.com/ramya-rao-a/go-outline
echo "4.install go-symbols"
go install github.com/acroca/go-symbols
echo "5.install guru"
go install golang.org/x/tools/cmd/guru
echo "6.install gorename"
go install golang.org/x/tools/cmd/gorename
echo "7.install gotests"
go install github.com/cweill/gotests/gotests
echo "8.install gomodifytags"
go install github.com/fatih/gomodifytags
echo "9.install impl"
go install github.com/josharian/impl
echo "10.install fillstruct"
go install github.com/davidrjenni/reftools/cmd/fillstruct
echo "11.install goplay"
go install github.com/haya14busa/goplay/cmd/goplay
echo "12.install godoctor"
go install github.com/godoctor/godoctor
echo "13.install dlv"
go install github.com/go-delve/delve/cmd/dlv
echo "14.install gocode-gomod"
go install github.com/stamblerre/gocode
echo "15.install godef"
go install github.com/rogpeppe/godef
echo "16.install goreturns"
go install github.com/sqs/goreturns
echo "17.install golint"
go install golang.org/x/lint/golint
echo "18.install goimports"
go install golang.org/x/tools/cmd/goimports
echo "finish"