【GoLang】golang 报管理工具 Godep 介绍

使用方法:  

提交:
cd ${GOPATH}/src/github.com/junneyang/xcloud
godep save -v ./...
rm -rf vendor/
git checkout --forcegit


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 mastergithub


使用:
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/xcloudgolang

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的错误。app

https://github.com/golang/tools 是 golang.org/x/tools的一个镜像,代码是同样的,因此我是以下安装的。ide

  • go get github.com/golang/toolsui

  • GOPATH\src\github.com目录下就有tools文件夹。3d

  • src下和github.com平级新建golang.org文件下,在此文件夹下建x文件夹,而后将tools都复制进去。code

  • 而后再执行go get github.com/tools/godepblog

  • 此时godep安装在你的GOPATH\bin目录下。

使用godep

创建一个演示项目来演示godep。

  • 此演示项目的路径要加入到GOPATH

  • 依赖的项目和项目自己都应该是个git repository

    • cd skeleton\src\wiselyman.org\app

      git init 
      git add .
      git commit
    • cd skeleton\src\xx.org\dep

      git init
      git add .   
      git commit
  • 项目目录及代码如图所示

 

  • skeleton\src\wiselyman.org\app目录下,执行godep save,此时会生成Godeps文件夹

  • 这时你能够移除xx.org目录了。

  • 继续使用将用如下命令





参考资料:http://studygolang.com/articles/2147http://www.01happy.com/golang-package-tool-godep/https://github.com/tools/godephttp://daozhao.goflytoday.com/2015/01/golang-godep/官方文档:https://github.com/tools/godepgodep go run main.go godep go build godep go install godep go test
相关文章
相关标签/搜索