dpvm7231 2017-07-25 17:35
浏览 145
已采纳

如何添加对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.

  • 写回答

1条回答 默认 最新

  • douqiao7958 2017-07-25 17:53
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?