使用方法:
提交:
cd ${GOPATH}/src/github.com/junneyang/xcloud
godep save -v ./...
rm -rf vendor/
git checkout --force
git init
git pull https://github.com/junneyang/xcloud.git master
git add --all
git commit -m "initial commit"
git remote add origin https://github.com/junneyang/xcloud.git
git push origin master
使用:
mkdir -p ${GOPATH}/src/github.com/junneyang
cd $_ && git clone https://github.com/junneyang/xcloud.git -b release3.1
cd ${GOPATH}/src/github.com/junneyang/xcloud
godep get -v ./...
godep/None go install -v ./...
godep/None go test -v ./...
参考开源项目codis
https://github.com/CodisLabs/codis
安装godep
官方的安装文档是使用go get github.com/tools/godep,很可惜,因为“网络”问题会报一个找不到golang.org/x/tools/go/vcs的错误。
而https://github.com/golang/tools 是 golang.org/x/tools的一个镜像,代码是一样的,所以我是如下安装的。
-
go get github.com/golang/tools -
在
GOPATHsrcgithub.com目录下就有tools文件夹。 -
在
src下和github.com平级新建golang.org文件下,在此文件夹下建x文件夹,然后将tools都复制进去。 -
然后再执行
go get github.com/tools/godep。 -
此时godep安装在你的
GOPATHin目录下。
使用godep
建立一个演示项目来演示godep。
-
此演示项目的路径要加入到GOPATH
-
依赖的项目和项目本身都应该是个git repository
-
cd skeletonsrcwiselyman.orgappgit init git add . git commit -
cd skeletonsrcxx.orgdepgit init git add . git commit
-
- 项目目录及代码如图所示
- 在
skeletonsrcwiselyman.orgapp目录下,执行godep save,此时会生成Godeps文件夹
-
这时你可以移除
xx.org目录了。 -
继续使用将用以下命令
godep go run main.go godep go build godep go install godep go test
参考资料:
http://studygolang.com/articles/2147
http://www.01happy.com/golang-package-tool-godep/
https://github.com/tools/godep
http://daozhao.goflytoday.com/2015/01/golang-godep/
https://segmentfault.com/a/1190000003781342
官方文档:https://github.com/tools/godep


