VScode中GO插件依賴安裝失敗問題


在VScode中下載並啟用GO插件的時候,會提示需要安裝一些依賴(如下所示)
點擊 install all后:

Tools environment: GOPATH=D:\BJ-Golang\gocode_lm
Installing 8 tools at D:\BJ-Golang\gocode_lm\bin in module mode.
  go-outline
  gotests
  gomodifytags
  impl
  goplay
  dlv
  staticcheck
  gopls

報錯如下:

Installing github.com/ramya-rao-a/go-outline@latest FAILED
{
 "killed": false,
 "code": 1,
 "signal": null,
 "cmd": "E:\\programs\\go\\bin\\go.exe install -v github.com/ramya-rao-a/go-outline@latest",
 "stdout": "",
 "stderr": "go: github.com/ramya-rao-a/go-outline@latest: module github.com/ramya-rao-a/go-outline: Get \"https://proxy.golang.org/github.com/ramya-rao-a/go-outline/@v/list\": dial tcp 142.251.42.241:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.\n"
}

參考:
在%GOPATH%\src\目錄下,建立路徑golang.org\x
(我的GOPATH=D:\BJ-Golang\gocode_lm)
進入到%GOPATH%\src\golang.org\x,下載需要工具的源碼git clone https://github.com/golang/tools.git
同樣的步驟創建%GOPATH%\src\github.com\golang,然后git clone https://github.com/golang/tools.git
進入到%GOPATH%下,執行

 go install github.com/ramya-rao-a/go-outline
//其中github.com/ramya-rao-a/go-outline部分根據前面自動install中的報錯更改即可
//例如:報錯信息:
//dlv: failed to install dlv(github.com/go-delve/delve/cmd/dlv@latest): Error: Command failed: E:\programs\go\bin\go.exe install -v github.com/go-delve/delve/cmd/dlv@latest
//go: github.com/go-delve/delve/cmd/dlv@latest: module github.com/go-delve/delve/cmd/dlv: Get "https://proxy.golang.org/github.com/go-delve/delve/cmd/dlv/@v/list": dial tcp 142.251.43.17:443: connectex: A connection //attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
//則 go install github.com/go-delve/delve/cmd/dlv
//如果此時報錯,則改為以下順序:
//go get github.com/go-delve/delve/cmd/dlv
//go install github.com/go-delve/delve/cmd/dlv
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM