为什么没有得到gopkg.in/..."同时工作"去获取github.com/..."好?

时间:2015-06-15 03:21:03

标签: windows git powershell github go

我尝试使用go get gopkg.in/fatih/pool.v2根据Readme.md安装pool,但无法取得成功:

C:\Users\xiaona\Documents\GitHub> go get -v gopkg.in/fatih/pool.v2
Fetching https://gopkg.in/fatih/pool.v2?go-get=1
https fetch failed.
Fetching http://gopkg.in/fatih/pool.v2?go-get=1
import "gopkg.in/fatih/pool.v2": http/https fetch: Get http://gopkg.in/fatih/poo
l.v2?go-get=1: dial tcp 107.178.216.236:80: ConnectEx tcp: A connection attempt
failed because the connected party did not properly respond after a period of ti
me, or established connection failed because connected host has failed to respon
d.
package gopkg.in/fatih/pool.v2: unrecognized import path "gopkg.in/fatih/pool.v2
"

在网络浏览器中访问107.178.216.236:80正常。

我尝试使用go get github.com/fatih/pool,它也可以正常使用。

有人能就这个问题提供一些线索吗?

BTW:我使用windows powershellgit版本为1.9.5

1 个答案:

答案 0 :(得分:0)

找到了根本原因:因为我的计算机使用Web代理,所以我需要在环境变量中设置代理:

C:\Users\xiaona>set https_proxy=https://web-proxy.corp.hp.com:8080/

C:\Users\xiaona>set http_proxy=https://web-proxy.corp.hp.com:8080/

C:\Users\xiaona>go get -v gopkg.in/fatih/pool.v2
Fetching https://gopkg.in/fatih/pool.v2?go-get=1
Parsing meta tags from https://gopkg.in/fatih/pool.v2?go-get=1 (status code 200)

get "gopkg.in/fatih/pool.v2": found meta tag main.metaImport{Prefix:"gopkg.in/fa
tih/pool.v2", VCS:"git", RepoRoot:"https://gopkg.in/fatih/pool.v2"} at https://g
opkg.in/fatih/pool.v2?go-get=1
gopkg.in/fatih/pool.v2 (download)
gopkg.in/fatih/pool.v2

然后,一切都好!