go get golang.org被墙问题解决
go get golang.org被墙问题解决
今天在下载golang.org/x/image/tiff的时候出错
> go get -v golang.org/x/image/tiff
Fetching https://golang.org/x/image/tiff?go-get=1
https fetch failed: Get https://golang.org/x/image/tiff?go-get=1: dial tcp 216.239.37.1:443: i/o timeout
package golang.org/x/image/tiff: unrecognized import path "golang.org/x/image/tiff" (https fetch: Get https://golang.org/x/image/tiff?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
网上看了一下,大致是由于墙的问题。
网上的方式大致有两种,一种是使用golang.org在github上的镜像,比如https://github.com/golang/image
在gopath目录下手动创建src/golang.org/x/, 然后直接使用git clone https://github.com/golang/image 到 src/golang.org/x/image目录
但是由于我最终希望下的是qor项目,它依赖非常多的golang.org/x/的项目,一个个这么做也是够累人的。
于是选择了第二个方法,设置proxy。
设置session的http_proxy
翻墙软件搭建在自己机器上, 使用端口61745, 先设置当前session使用的http_proxy
export http_proxy="http://127.0.0.1:61745" export https_proxy=$http_proxy
设置完成之后,但是还是出现问题:
go get -v golang.org/x/image/tiff
Fetching https://golang.org/x/image/tiff?go-get=1
Parsing meta tags from https://golang.org/x/image/tiff?go-get=1 (status code 200)
get "golang.org/x/image/tiff": found meta tag get.metaImport{Prefix:"golang.org/x/image", VCS:"git", RepoRoot:"https://go.googlesource.com/image"} at https://golang.org/x/image/tiff?go-get=1
get "golang.org/x/image/tiff": verifying non-authoritative meta tag
Fetching https://golang.org/x/image?go-get=1
Parsing meta tags from https://golang.org/x/image?go-get=1 (status code 200)
golang.org/x/image (download)
# cd .; git clone https://go.googlesource.com/image /Users/yejianfeng/Documents/gopath/src/golang.org/x/image
Cloning into '/Users/yejianfeng/Documents/gopath/src/golang.org/x/image'...
fatal: unable to access 'https://go.googlesource.com/image/': Failed to connect to go.googlesource.com port 443: Operation timed out
package golang.org/x/image/tiff: exit status 128
设置git的http_proxy
大致再搜了一下,是git的http_proxy没有设置好。
于是做了一下设置:
git config --global http.proxy http://127.0.0.1:61745
终于可以了
go get -v golang.org/x/image/tiff
Fetching https://golang.org/x/image/tiff?go-get=1
Parsing meta tags from https://golang.org/x/image/tiff?go-get=1 (status code 200)
get "golang.org/x/image/tiff": found meta tag get.metaImport{Prefix:"golang.org/x/image", VCS:"git", RepoRoot:"https://go.googlesource.com/image"} at https://golang.org/x/image/tiff?go-get=1
get "golang.org/x/image/tiff": verifying non-authoritative meta tag
Fetching https://golang.org/x/image?go-get=1
Parsing meta tags from https://golang.org/x/image?go-get=1 (status code 200)
golang.org/x/image (download)
golang.org/x/image/tiff/lzw
golang.org/x/image/tiff
也可以很方便使用 go get -u 来下载项目的依赖了。
取消
session的http_proxy是关闭session之后会取消的。
但是git的http.proxy这里是设置的全局的,我们下载完成之后,希望进行取消的话,执行操作:
git config --global --unset http.proxy
后记
据说现在有
参考文档
go get golang.org被墙问题解决的更多相关文章
- 解决 VS Code 中 golang.org 被墙导致的 Go 插件安装失败问题
微软官方开发的 Go for Visual Studio Code 插件为 Go 语言 提供了丰富的支持.在 VS Code 中首次打开 Go 工作区后,VS Code 会自动检测当前开发环境为 Go ...
- Golang学习 - 学习资源列表
Golang 学习资源: <Go 语言圣经(中文版)> - 书籍 http://shinley.com/index.html <学习 Go 语言> - 书籍 http://w ...
- VS code golang 开发环境搭建
安装go (1)下载go安装程序 下载地址:https://golang.org/dl/(墙内下载地址http://www.golangtc.com/download),如果是您的系统是windows ...
- Centos7安装golang
标准官网:https://golang.org/ 需要墙 镜像官网:https://golang.google.cn/dl/ [国内推荐] 1.下载文件 # wget https://dl.googl ...
- Go语言开发第一个Hello,World
在网上看到go语言的各种评价,也是闻名已久,但是没有自己实践过,也不知道它的好,它的坏,今天就来试试第一个小程序 第一步.如何下载 1)下载go安装程序 下载地址:https://golang.org ...
- Go语言开发环境配置
一.我为什么要学习go语言 当今已经是移动和云计算时代,Go出现在了工业向云计算转型的时刻,简单.高效.内 置并发原语和现代的标准库让Go语言尤其适合云端软件开发(毕竟它就是为此而设计的).到2014 ...
- (转载)Go语言开发环境配置
一.我为什么要学习go语言 当今已经是移动和云计算时代,Go出现在了工业向云计算转型的时刻,简单.高效.内 置并发原语和现代的标准库让Go语言尤其适合云端软件开发(毕竟它就是为此而设计的).到2014 ...
- Go语言开发环境搭建
1.Go的安装 (1)下载go安装程序 下载地址:https://golang.org/dl/ (墙内下载地址http://www.golangtc.com/download),如果是您的系统是win ...
- go——搭建Win7下的Go开发环境
1.首先需要下载下载go平台安装包 安装程序 下载地址:https://golang.org/dl/ (墙内下载地址http://www.golangtc.com/download),如果是您的系统是 ...
随机推荐
- 内连接查询 (select * from a join b on a.id = b.id) 与 关联查询 (select * from a , b where a.id = b.id)的区别
转自https://blog.csdn.net/l690781365/article/details/76261093 1.首先了解 on .where 的执行顺序以及效率? from a join ...
- bzoj 4173 打表???
没有任何思路,打表发现ans=phi(n)*phi(m)*n*m %%% popoqqq Orz 然而并没有看懂-- #include<cstdio> #include<cstrin ...
- BZOJ_2743_[HEOI2012]采花_离线+树状数组
BZOJ_2743_[HEOI2012]采花_离线+树状数组 Description 萧芸斓是Z国的公主,平时的一大爱好是采花.今天天气晴朗,阳光明媚,公主清晨便去了皇宫中新建的花园采花 .花园足够大 ...
- Spring事务(一) Markdown 版
事务 事务的特性(ACID) 原子性(Atomicity) 原子性要求事务所包含的全部操作是一个不可分割的整体,这些操作要么全部提交成功,要么只要其中一个操作失败,就全部"成仁" ...
- Windows上安装配置SSH教程(6)——综合应用:在Windows上实现SSH远程登陆与文件传输
----------------- 声明:本教程现已经弃用.由于客户端同时安装Cygwin和OpenSSH for Windows会出现问题(Cygwin的shell下无法使用ssh命令),建议直接在 ...
- Appium 【已解决】提示报错:Attempt to re-install io.appium.android.ime without first uninstalling.
详细报错:Failed to install D:\AutoTest\appium\Appium\node_modules\appium\build\unicode_ime_apk\UnicodeIM ...
- MVC动态绑定下拉框
Controller: //获取下拉信息表 //_vendorsAppService.GetAllObj() 是获取下拉列表结果集 ViewData["vendlist"] = n ...
- centos7 启动docker失败的解决
控制端使用yum install docker安装完成docker后启动docker失败,出现以下信息: Job for docker.service failed because the contr ...
- python接口自动化(二十六)--批量执行用例 discover(详解)
简介 我们在写用例的时候,单个脚本的用例好执行,那么多个脚本的时候,如何批量执行呢?这时候就需要用到 unittest 里面的 discover 方法来加载用例了.加载用例后,用 unittest 里 ...
- Android缓存机制——LruCache
概述 LruCache的核心原理就是对LinkedHashMap的有效利用,它的内部存在一个LinkedHashMap成员变量,值得注意的4个方法:构造方法.get.put.trimToSize LR ...