Last active
July 15, 2019 06:24
-
-
Save tomjamescn/d5549fb4f73c67823120c3d0b4aa44f9 to your computer and use it in GitHub Desktop.
国内快速安装golang.org/x下的包
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 网络环境会导致直接安装失败,使用此脚本可以避免这个问题 | |
if [ -z $GOPATH ];then | |
echo "GOPATH not exists!" | |
exit 1 | |
fi | |
dir=$GOPATH/src/golang.org/x | |
mkdir -p $dir | |
cd $dir | |
go_x_packages=("tools" \ | |
"lint" \ | |
"crypto" \ | |
"debug" \ | |
"image" \ | |
"net" \ | |
"sys" \ | |
"text" \ | |
"time" \ | |
"sync" | |
) | |
for i in ${go_x_packages[@]}; | |
do | |
echo $i | |
if [ -d "$i" ]; then | |
#已经存在了,更新 | |
cd $i | |
git pull | |
cd ../ | |
else | |
# | |
git clone https://github.com/golang/${i}.git | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment