Go Get安装一些第三方库-网络问题

go在go get 一些 package时候的会由于众所周知的原因而无法下载。比如在安装 bee的时候有可能会遇到无法下载 golang.org/x/sys/unix 的问题。

1
unrecognized import path "golang.org/x/sys/unix"

解决方案:手动从github下载相应的package

1
2
git clone --depth=1 https://github.com/golang/xxx.git
git clone --depth=1 https://github.com/golang/xxx.git

注:xxx 为对应的需要的库

下载完成后,软链或者复制$GOPATH/src/golang.org/x/ 下即可。

1
2
3
4
5
6
7
golang.org/
└── x
├── net
├── sys
└── tools

4 directories

更为简便的方法:

1
2
3
4
5
mkdir -p $GOPATH/src/golang.org/x/
cd !$
git clone https://github.com/golang/net.git
git clone https://github.com/golang/sys.git
git clone https://github.com/golang/tools.git

0%