Golang.org/x目录被Blocked的解决方案

栏目: Go · 发布时间: 7年前

内容简介:在Go开发中,经常有大量项目依赖golang.org/x包,但这个源码包被储放在万恶的国外资本势力的服务器上,国内开发人员想要使用需要一翻动作。golang团队将他们的代码镜像在Github上,因此,我们可以将golang.org/x使用到的包,统统下载在我们开发环境的首先,在 $GOPATH 目录中创建 golang.org/x 目录:

Go 开发中,经常有大量项目依赖golang.org/x包,但这个源码包被储放在万恶的国外资本势力的服务器上,国内开发人员想要使用需要一翻动作。

golang团队将他们的代码镜像在Github上,因此,我们可以将golang.org/x使用到的包,统统下载在我们开发环境的 $GOPATH/src/golang.org/x 目录,编译项目时就可以直接使用本地依赖。

首先,在 $GOPATH 目录中创建 golang.org/x 目录:

$ mkdir -p $GOPATH/src/golang.org/x

然后把 x 的几个包clone下来:

$ cd $GOPATH/src/golang.org/x
# Clone 常用和几个库:
$ git clone --depth=1 https://github.com/golang/tools.git
$ git clone --depth=1 https://github.com/golang/sys.git
$ git clone --depth=1 https://github.com/golang/crypto.git
$ git clone --depth=1 https://github.com/golang/text.git
$ git clone --depth=1 https://github.com/golang/net.git

其它库以相同方式处理。


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Prometheus: Up & Running

Prometheus: Up & Running

Brian Brazil / O'Reilly Media / 2018-7-9 / USD 49.99

Get up to speed with Prometheus, the metrics-based monitoring system used by tens of thousands of organizations in production. This practical guide provides application developers, sysadmins, and DevO......一起来看看 《Prometheus: Up & Running》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

MD5 加密
MD5 加密

MD5 加密工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具