vs code 配置 golang 开发环境

安装官方 go 开发插件

image.png

安装相关组件

  • 新建任意一 .go 文件,保存
  • 安装依赖的组件
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
  • 国内相关组件会安装超时
    git clone https://github.com/golang/tools.git tools
    将 tools 目录移动至 $GOPATH/x 目录下
  • 然后手动安装相关组件
    go install ...
    go install golang.org/x/tools/cmd/guru

安装完成

你可能感兴趣的:(vs code 配置 golang 开发环境)