在使用 `dep init` 时,不在任何 GOPATH 中。

huangapple go评论179阅读模式
英文:

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指向一个根目录,其中包含binpkgsrc子目录,项目源代码位于src下。像godepgo 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.

huangapple
  • 本文由 发表于 2017年5月24日 02:20:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/44142289.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定