由于众所周知的原因,golang在下载golang.org的包时会出现访问不了的情况。尤其是x包,很多库都依赖于它。由于x包在github上都有镜像,我们可以使用从github.com上先clone下来,再做软链接的方式曲线救国。
mkdir -p $GOPATH/src/github.com/golang/
git clone https://github.com/golang/sys.git $GOPATH/src/github.com/golang/sys
git clone https://github.com/golang/net.git $GOPATH/src/github.com/golang/net
git clone https://github.com/golang/text.git $GOPATH/src/github.com/golang/text
git clone https://github.com/golang/lint.git $GOPATH/src/github.com/golang/lint
git clone https://github.com/golang/tools.git $GOPATH/src/github.com/golang/tools
git clone https://github.com/golang/crypto.git $GOPATH/src/github.com/golang/crypto
ln -s $GOPATH/src/github.com/golang/ $GOPATH/src/golang.org/x
有疑问加站长微信联系(非本文作者)