Godep save deletes all deps in vendor and godep update

1k Views Asked by At

Im pretty new to Go but not to software. Im working on a new team with lots of projects and dependencies so we must use godep.

All the code is structure in the standard Go way, with files in $GOPATH/.../github.com/... etc (including our work which is in github)

I made changes to project A (github.com/ourTeam/A) and I want to run project B (github.com/ourTeam/B) which references A to test my code. so I commit my work from A in my own branch in A, (and even pushed the branch).

-> All I want is to update B with my new version of A.

From B, I tried:

  • godep update github.com/A/subpackage. It said 'godep: no packages can be updated'
  • godep save. It deleted EVERYTHING in the vendor folder, leaving the Godeps.json file empty from any dependencies
  • manually updating Godeps.json with my commit, then running godep update. No message but it didnt update anything. Godep save after this change deleted everything too in the vendor folder and Godep.json

What am I missing ?

Note: Im using godep v65 (darwin/amd64/go1.6.2) and godep save -v said

godep: Finding dependencies for [.]
godep: Found package: github.com/ourTeam/B
godep:  Deps:
(nothing so the diff with old file removes everything)
1

There are 1 best solutions below

1
On BEST ANSWER

The error message when you tried to update tells me that the dependency on A had not been godep-saved before in B. That would mean you need to save it, instead of updating.

Today, I was having the same problem as you using godep save. All dependencies were being removed. However, this got me through it:

$ go get -u github.com/tools/godep # Make sure you have the latest godep (currently v71)
$ godep save ./... # Literally, "./..." is the argument

# The above command may fail with "Package not found ..."
# Install any package not found with "go get some/package/path"
$ go get some/package/path # if necessary
# Try "godep save ./..." again; repeat "go get" for any "not found" errors.

Once godep save returned without errors, I checked and it had done as expected. It only added the new dependency I had imported in the code.