Godeps development flow?

72 Views Asked by At

Bit confused with Godeps in general. Say I'm contributing Go code to a central repository, and now I need to pull the code and contribute my own code changes. What would be the correct godep flow?

Would it be:

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
1

There are 1 best solutions below

0
On BEST ANSWER

One option:

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

But, I don't like restoring to my GOPATH in disconnected HEAD states of git, since I contribute to several other repos (and have gotten errors in the past with this) directly within my GOPATH.

So I usually do this:

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

Using godep as a prefix changes the $GOPATH for go-related functions.

TIP: set all the flags of your main executable with sensible defaults, for all developers. That way they don't need to pass custom parameters just for local development.