【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
相關文章
相關標籤/搜索