1. 程式人生 > 實用技巧 >vscode安裝go相關外掛失敗或go get安裝第三方包失敗

vscode安裝go相關外掛失敗或go get安裝第三方包失敗

比如安裝下面第三方包

C:\Users\xxx>go get github.com/denisenkom/go-mssqldb
go get github.com/denisenkom/go-mssqldb: module github.com/denisenkom/go-mssqldb: Get "https://proxy.golang.org/github.com/denisenkom/go-mssqldb/@v/list": dial tcp 172.217.24.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.

或vscode安裝下面的失敗

Installing 8 tools at D:\GoPath\bin
  go-outline
  go-symbols
  guru
  gorename
  dlv
  godef
  goreturns
  golint

Installing golang.org/x/tools/cmd/guru FAILED
Installing github.com/ramya-rao-a/go-outline FAILED
Installing golang.org/x/tools/cmd/gorename FAILED
Installing github.com/derekparker/delve/cmd/dlv SUCCEEDED
Installing github.com/acroca/go-symbols FAILED
Installing golang.org/x/tools/cmd/guru FAILED
Installing github.com/rogpeppe/godef SUCCEEDED
Installing golang.org/x/tools/cmd/gorename FAILED
Installing github.com/derekparker/delve/cmd/dlv SUCCEEDED
Installing github.com/rogpeppe/godef SUCCEEDED
Installing github.com/sqs/goreturns FAILED
Installing github.com/golang/lint/golint FAILED

解決方法

  • 從GitHub上clone下來安裝
  • 最省事的:改GOPROXY代理環境變數為https://goproxy.cn,或其他代理地址