Visual Studio Code Go插件配置选项

Visual Studio Code Go插件配置选项

  • go get命令和go install命令的区别
    • go get 命令的作用
      • 从远程下载需要用到的包
      • 下载完之后,执行go install
    • go install 命令的作用
      • 生成可执行文件后,放在%GOPATH%/bin目录下
  • 需要下载的插件
dlv

gocode

godef

golint

go-find-references

go-outline

goreturns

gorename

gopkgs

go-symbols
  • 直接go get命令下载
go get -u -v github.com/derekparker/delve/cmd/dlv
go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/lukehoban/go-find-references
go get -u -v github.com/lukehoban/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols
  • 但是这样,因为被墙的原因,有的插件不能通过这些命令直接下载。解决方法

    • 在%GOPATH%/src的文件夹下创建golang.org/x文件夹。打开Git Bash,执行下面命令:(注:前提要有git操作基础)
    git clone https://github.com/golang/tools.git tools
    git clone https://github.com/golang/lint.git
    
  • 克隆下文件之后,运行下面的命令,生成可执行文件放在%GOPATH%/bin目录下

go install github.com/derekparker/delve/cmd/dlv

go install github.com/nsf/gocode

go install github.com/rogpeppe/godef

go install github.com/golang/lint/golint

go install github.com/lukehoban/go-find-references

go install github.com/lukehoban/go-outline

go install github.com/sqs/goreturns

go install golang.org/x/tools/cmd/gorename

go install github.com/tpng/gopkgs

go install github.com/acroca/go-symbols
  • 下载完这些插件之后,最能够解决的问题为:
    • 在vscode中写golang能够有提示
posted @ 2019-09-17 19:14  Myuniverse  阅读(571)  评论(0编辑  收藏  举报