windows - 为什么 "go get gopkg.in/..."不工作而 "go get github.com/..."正常?

标签 windows git powershell github go

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

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,它也可以正常工作。

谁能就这个问题提供一些线索?

顺便说一句:我使用 windows powershellgit 版本是 1.9.5

最佳答案

根本原因找到了:因为我的电脑使用了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

那么,一切就OK了!

关于windows - 为什么 "go get gopkg.in/..."不工作而 "go get github.com/..."正常?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30836901/

相关文章:

powershell - 何时使用推送位置与设置位置?

c# - 从远程计算机删除文件

java - RapidMiner 6安装问题

c++ - 统一调节程序执行率[Windows C++]

git - 如何判断你的头是否在 git 中分离?

git - 我如何删除最后 3 次提交?

windows - 在 Windows 上使用 Pandoc 连接多个 Markdown 文件

git - "git log -1"有什么作用?

powershell - 在 Powershell 中获取解析的文件路径

wpf - PowerShell 可以用作 WPF 的代码吗