提交:
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/tools
ui
在GOPATH\src\github.com
目錄下就有tools
文件夾。3d
在src
下和github.com
平級新建golang.org
文件下,在此文件夾下建x
文件夾,而後將tools
都複製進去。code
而後再執行go get github.com/tools/godep
。blog
此時godep安裝在你的GOPATH\bin
目錄下。
創建一個演示項目來演示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