下面是測試結(jié)果
- 自帶的vendor
- 項目創(chuàng)建vendor子目錄,然后github的地址放進去就ok了
- govendor
- 安裝:go get -u github.com/kardianos/govendor
- 初始化:govendor init
- 測試:govendor fetch github.com/ziyouchutuwenwu/objective-go
- 問題:
fetch貌似沒有把所有的子目錄都弄下來
get裝到GOPATH里面去了,蛋疼
- gvt
- 安裝:go get -u github.com/FiloSottile/gvt
- 測試:gvt fetch github.com/ziyouchutuwenwu/objective-go
- 優(yōu)勢:
全部下載,支持tag和branch下載
- gb
- 安裝:go get github.com/constabulary/gb/...
- 測試:gvt fetch github.com/ziyouchutuwenwu/objective-go
- 問題:
先下載依賴庫,成功以后下載需要的repo,全部成功以后才會在vendor目錄里面,在天朝,golang.org的訪問出問題,這個模式不太好
- glide
- 安裝:go get github.com/Masterminds/glide
- 初始化:glide create
- 下載:glide install
- 優(yōu)勢:
根據(jù)你的代碼自動發(fā)現(xiàn)需要的import包,創(chuàng)建yaml文件,適合團隊合作(沒必要在自己的項目repo里面帶一堆三方庫,靠這個就可以了)
支持自定義鏡像,這個在別的里面沒發(fā)現(xiàn)
直接glide
配置方式
rm -rf ~/.glide
mkdir -p ~/.glide
glide mirror set https://golang.org/x/mobile https://github.com/golang/mobile --vcs git
glide mirror set https://golang.org/x/crypto https://github.com/golang/crypto --vcs git
glide mirror set https://golang.org/x/net https://github.com/golang/net --vcs git
glide mirror set https://golang.org/x/tools https://github.com/golang/tools --vcs git
glide mirror set https://golang.org/x/text https://github.com/golang/text --vcs git
glide mirror set https://golang.org/x/image https://github.com/golang/image --vcs git
glide mirror set https://golang.org/x/sys https://github.com/golang/sys --vcs git