英文:
Not in any GOPATH while using dep init
问题
我正在尝试使用godep
来安装我的依赖项,但似乎无法使其工作。当我运行GODEP init
时,我收到以下错误信息:
determineProjectRoot: /home/cjds/development/core/data-service 不在任何 $GOPATH 中
但是我的 GOPATH 绝对包含该路径。这是我的整个 GOPATH:
/home/cjds/development/core/data-service
go install
导致以下错误,这可能是问题的根源:
/home/cjds/development/core/data-service 中没有可构建的 Go 源文件
然而,文件夹结构中有一个 src
文件夹,然后是一个 main
文件夹,然后是我的整个 Go 项目:
-/home/cjds/development/core/data-service/src/main/my-go-files.go
英文:
I'm trying to use godep
to install my dependencies but I can't seem to get it to work. When I run GODEP init, I get the following error
>determineProjectRoot: /home/cjds/development/core/data-service not in any $GOPATH
But my GOPATH definitely contains that path. This is my whole go path
> /home/cjds/development/core/data-service
go install
causes the following error, which may be the root of the problem:
>no buildable Go source files in /home/cjds/development/core/data-service
The folder structure however has a src
folder, and then a main
folder and then my whole Go project
>-/home/cjds/development/core/data-service/src/main/my-go-files.go
答案1
得分: 7
你的GOPATH
指向一个根目录,其中包含bin
、pkg
和src
子目录,项目源代码位于src
下。像godep
和go install
这样的工具希望在源代码上操作,而不是在整个GOPATH
上操作,因此必须在$GOPATH/src
下的某个路径上运行。
英文:
Your GOPATH
points to a root directory containing bin
, pkg
, and src
subdirectories, with project source under src
. Tools like godep
and go install
expect to operate on source, not on your entire GOPATH
, so must be run on some path under $GOPATH/src
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论