goproxy.cn解决go get 失败问题

作者: root007 分类: 未分类 发布时间: 2019-09-10 17:22

 go get golang.org/x 包失败

“golang.org/x/sys/windows” (https fetch: Get https://golang.org/x/sys/windows?go-get=1: dial tcp 216.239.37.1: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.)

https://github.com/goproxy/goproxy.cn


GOPROXY 环境变量

Go 1.13 及以上(推荐)

打开你的终端并执行:

$ go env -w GOPROXY=https://goproxy.cn,direct

完成。

macOS 或 Linux

打开你的终端并执行:

$ export GOPROXY=https://goproxy.cn

或者

$ echo "export GOPROXY=https://goproxy.cn" >> ~/.profile && source ~/.profile

完成。

Windows

打开你的 PowerShell 并执行:

C:\> $env:GOPROXY = "https://goproxy.cn"

不过,需要依赖于 go module 功能。可通过 export GO111MODULE=on 开启 MODULE。

如果项目不在 GOPATH 中,则无法使用 go get ...,但可以使用 go mod ... 相关命令。

也可以通过置空这个环境变量来关闭,export GOPROXY=

批话那么其实只需要:

go env -w GOPROXY=https://goproxy.cn,direct
go env -w  GO111MODULE=on

go get github.com/prometheus/client_golang/prometheus/promhttp
go: finding github.com/prometheus/client_golang v1.1.0
go: downloading github.com/prometheus/client_golang v1.1.0
go: extracting github.com/prometheus/client_golang v1.1.0
go: downloading github.com/prometheus/common v0.6.0
go: downloading github.com/prometheus/procfs v0.0.3
go: downloading github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90
go: downloading github.com/beorn7/perks v1.0.1

发表评论

邮箱地址不会被公开。 必填项已用*标注


  • http://ediconcept.odns.fr/maillotdefootpascher.html
  • http://ediconcept.odns.fr/maillotsfootpascher.html
  • http://ediconcept.odns.fr/maillotsfootpascher2022.html
  • https://sergiofajardo.co/maillotdefootpascher.html
  • https://sergiofajardo.co/maillotsfootballpascher.html
  • https://sergiofajardo.co/maillotsfootpascherfrance.html
  • https://allphonetoys.com/maillotdefootpascher.html
  • https://allphonetoys.com/nouveaumaillotdefootpascher.html
  • https://allphonetoys.com/nouveaumaillotsdefootball.html
  • http://samosystem.nichost.ru/maillotdefootpascher.html
  • http://samosystem.nichost.ru/nouveaumodèlemaillotdefoot.html
  • http://samosystem.nichost.ru/pascherfemmesfootballjersey.html
  • http://w96397on.beget.tech/maillotdefootpascher.html
  • http://w96397on.beget.tech/pascherfootballt-shirts.html
  • http://w96397on.beget.tech/paschermaillotsdefootpromo.html
  • http://wesleywang.acsite.org/maillotdefootpascher.html
  • https://wesleywang.acsite.org/repliquemaillotsdefootballlivraisongratuite.html
  • https://wesleywang.acsite.org/retrovintagesoccerjerseys.html
  • https://www.rnkhabri.com/maillotdefootpascher.html
  • https://www.rnkhabri.com/personnaliséenfantssoccerjersey.html
  • https://www.rnkhabri.com/personnaliséfemmessoccervêtements.html
  • https://www.oujdacity.net/maillotdefootpascher.html
  • https://www.oujdacity.net/sitedemaillotdefootpascher.html
  • https://www.oujdacity.net/survetementdefoot.html
  • https://infendo.com/maillotdefootpascher.html
  • https://infendo.com/survetementdefootpascher.html
  • https://infendo.com/uniformedefootballdesjeunes.html
  • https://planitagency.com/maillotdefootpascher.html
  • https://planitagency.com/ventemaillotdefootpascherthailande2022.html
  • https://planitagency.com/vesteequipedefoot.html
  • http://immergut.com.br
  • https://immobiliarelerosemarine.com
  • https://immobilienfotografie24.de
  • http://immobilier-lemaroc.com
  • https://imobilideranca.com.br
  • https://impactdigital.space
  • https://imperibiza.com
  • https://impexworldltd.com
  • https://implant.gen.tr
  • https://impread.com
  • http://improveyourdance.com
  • http://improvisamos.com
  • http://impulsarh.com.ar
  • http://inamakethat.com
  • http://inanna.be
  • https://incomementorbox.com
  • https://incomerepairpro.com
  • https://indiatvnewss.com
  • https://indoranews.com
  • https://infendo.com
  • https://infinitebankingagenttraining.com
  • https://infinnium.com
  • http://influenceyourway.com
  • http://infocarbrokers.net
  • http://infohealth-usa.com
  • https://informatic-crew.fr
  • https://informatiotech.com
  • https://informeblumenau.com
  • https://infos-grossesse.fr
  • https://ingatlanmagus.com