user5906464
user5906464

Reputation:

How to add dependency to godep.json?

I'm having hard time to add a dependency to the Godeps.json file. I think I've messed up the GOPATH. I tried various suggestions on the warnings but none of them worked for me. My GOPATH is /Users/sarath/project. which go is /usr/local/bin/go. If I try to do godep save ./..., it is giving me the following warning:

godep: [WARNING]: godep should only be used inside a valid go package directory and
godep: [WARNING]: may not function correctly. You are probably outside of your $GOPATH.
godep: [WARNING]:   Current Directory: /Users/sarath/project
godep: [WARNING]:   $GOPATH: /Users/sarath/project
godep: Unable to find SrcRoot for package .

I have my pkg inside the /Users/sarath/project.

Upvotes: 3

Views: 606

Answers (1)

Adrian
Adrian

Reputation: 46432

That definitely won't work. GOPATH isn't just the path of some project; it's the root of a directory, which contains bin, pkg, and src directories; the src directory contains package-named directories for projects. So you should be running godep from your project directory, which (given your current GOPATH) should be /Users/sarath/project/src/<repopath> - e.g. /Users/sarath/project/src/github.com/sarath/myproject.

Upvotes: 6

Related Questions