How to add dependency on godep.json?
I find it difficult to add a dependency to a file Godeps.json
. I seem to have messed up GOPATH
. I've tried various suggestions for warnings but none of them worked for me. My GOPATH /Users/sarath/project
.
which go
- /usr/local/bin/go
. If I try to do it godep save ./...
, it gives 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 it pkg
inside /Users/sarath/project
.
It definitely won't work. GOPATH is not just a project path; this is the root of the directory that contains directories bin
, pkg
and src
; directory src
contains directories with package names for projects. Therefore you have to run godep
from your project directory which (given your current GOPATH) should be /Users/sarath/project/src/<repopath>
- eg. /Users/sarath/project/src/github.com/sarath/myproject
...
source to share