golang.org/x/ 包无法下载问题

诶,这个墙呦!!!!难受

Prerequisites

你的机器需要安装git
linux安装git可以使用:

yum -y install wget
wget https://gitee.com/oneslideicywater/mysql-community-ha/raw/master/git-build-fromsource.sh
bash git-build-fromsource.sh

问题根源

或者你可以尝试下面地脚本,如果你的环境允许的话

将go团队的开源项目的全部包下载下来,你以后不用一个个复制了。golang.org/x/的包存放在这个github地址。在你的GOPATH环境变量所代表的路径下创建一个golang.org/x/文件夹,
这样在IDE引入这些工具包的时候,就报错了。

# 有必要把一些工具包弄下来,就不说作用了
git clone https://github.com/golang/crypto.git
git clone https://github.com/golang/mobile.git
git clone https://github.com/golang/oauth2.git
git clone https://github.com/golang/sys.git
git clone https://github.com/golang/tools.git
git clone https://github.com/golang/net.git
git clone https://github.com/golang/time.git
git clone https://github.com/golang/tour.git
git clone https://github.com/golang/sync.git
git clone https://github.com/golang/image.git
git clone https://github.com/golang/text.git
git clone https://github.com/golang/perf.git

Windows 环境

@echo off

cd %GOPATH%\src
mkdir %GOPATH%\src\golang.org\x
cd  %GOPATH%\src\golang.org\x
git clone https://github.com/golang/crypto.git
git clone https://github.com/golang/mobile.git
git clone https://github.com/golang/oauth2.git
git clone https://github.com/golang/sys.git
git clone https://github.com/golang/tools.git
git clone https://github.com/golang/net.git
git clone https://github.com/golang/time.git
git clone https://github.com/golang/tour.git
git clone https://github.com/golang/sync.git
git clone https://github.com/golang/image.git
git clone https://github.com/golang/text.git
git clone https://github.com/golang/perf.git

将上面的文本保存在名字为.bat的文件中,管理员身份运行

Linux 环境

#!/bin/bash
mkdir $GOPATH/src/golang.org/x
cd $GOPATH/src/golang.org/x
git clone https://github.com/golang/crypto.git
git clone https://github.com/golang/mobile.git
git clone https://github.com/golang/oauth2.git
git clone https://github.com/golang/sys.git
git clone https://github.com/golang/tools.git
git clone https://github.com/golang/net.git
git clone https://github.com/golang/time.git
git clone https://github.com/golang/tour.git
git clone https://github.com/golang/sync.git
git clone https://github.com/golang/image.git
git clone https://github.com/golang/text.git
git clone https://github.com/golang/perf.git

你可能感兴趣的:(go)