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
  • 可是這樣,由於被牆的緣由,有的插件不能經過這些命令直接下載。解決方法git

    • 在%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目錄下github

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可以有提示
相關文章
相關標籤/搜索