Skip to content

Instantly share code, notes, and snippets.

@tomjamescn
Last active July 15, 2019 06:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomjamescn/d5549fb4f73c67823120c3d0b4aa44f9 to your computer and use it in GitHub Desktop.
Save tomjamescn/d5549fb4f73c67823120c3d0b4aa44f9 to your computer and use it in GitHub Desktop.
国内快速安装golang.org/x下的包
#!/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