2016-05-10 35 views
3

與Godeps混淆在一起。假設我將Go代碼貢獻給中央存儲庫,現在我需要提取代碼並貢獻我自己的代碼更改。什麼是正確godep流量?Godeps開發流程?

難道是:

git pull // pull latest master 
godep restore // Install the package versions specified in Godeps/Godeps.json to $GOPATH 
go get foo/bar // Get package foo/bar and edit your code to import foo/bar 
godep save ./... // Saves dependencies 
// Then, check into source control 

回答

0

一個選項:

git pull 
godep restore 
go get -u foo/bar // -u updates 
go test ./... 
go run main.go 
godep save ./... 

但是,我不喜歡恢復到我的GOPATH Git中的斷開HEAD狀態,因爲我對其他幾個回購貢獻(並在過去得到了錯誤)直接在我的GOPATH中。

所以我通常這樣做:

git pull 
go get -u foo/bar 
godep update foo/bar 
godep go test ./... 
godep go run main.go 

使用godep作爲前綴改變了去相關功能的$ GOPATH。

提示:爲所有開發人員設置主要可執行文件的所有flags合理的默認設置。這樣他們就不需要爲本地開發傳遞自定義參數。