解決vscode中golang外掛程式依賴安裝失敗問題
vscode中安裝ms-vscode.go外掛程式後可以開啟對go語言的支援,ms-vscode.go外掛程式需要依賴一些工具,安裝完成後提示
Installing github.com/nsf/gocode SUCCEEDEDInstalling github.com/uudashr/gopkgs/cmd/gopkgs SUCCEEDEDInstalling github.com/ramya-rao-a/go-outline FAILEDInstalling github.com/acroca/go-symbols FAILEDInstalling golang.org/x/tools/cmd/guru FAILEDInstalling golang.org/x/tools/cmd/gorename FAILEDInstalling github.com/fatih/gomodifytags SUCCEEDEDInstalling github.com/haya14busa/goplay/cmd/goplay SUCCEEDEDInstalling github.com/josharian/impl FAILEDInstalling github.com/rogpeppe/godef SUCCEEDEDInstalling sourcegraph.com/sqs/goreturns FAILEDInstalling golang.org/x/lint/golint FAILEDInstalling github.com/cweill/gotests/... FAILEDInstalling github.com/derekparker/delve/cmd/dlv SUCCEEDED 8 tools failed to install.
由於網路原因,一些依賴工具無法正常安裝,需要進行手動安裝.
以下為手動安裝的工具的步驟:
-
在%GOPATH%\src\目錄下,建立路徑golang.org\x
-
進入到%GOPATH%\src\golang.org\x,下載需要工具的源碼git clone https://github.com/golang/tools.git tools
-
clone完成後,會產生一個tools檔案夾,這樣工具所需要的源碼已經準備好了
-
進入到%GOPATH%下,執行
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/rogpeppe/godef go install github.com/sqs/goreturns go install github.com/cweill/gotests/gotests
-
單獨處理golint,golint的源碼位於https://github.com/golang/lint,進入%GOPATH%\src\golang.org\x後執行git clone https://github.com/golang/lint下載golint需要的源碼
-
進入到%GOPATH%下,執行go install github.com/golang/lint/golint
這樣,vscode的golang外掛程式所依賴的工具安裝完成了。