[英]Unable to setup Gandalf Go
I am trying to setup Gandalf but when I do go get github.com/JumboInteractiveLimited/Gandalf
I'm getting error我正在尝试设置 Gandalf,但是当我执行
go get github.com/JumboInteractiveLimited/Gandalf
时出现错误
package github.com/jmartin82/mmock/definition: cannot find package "github.com/jmartin82/mmock/definition" in any of:
/usr/local/go/src/github.com/jmartin82/mmock/definition (from $GOROOT)
<My_Go_Path>/src/github.com/jmartin82/mmock/definition (from $GOPATH)
This reached me via a GitHub Issue however I thought it best to mention it here for clarity.这是通过GitHub 问题传达给我的,但是为了清楚起见,我认为最好在此处提及。
Gandalf utilizes go modules to pin dependency versions, go get
will download the latest version of a dependency rather than the version a project actually supports where as something like go mod download
will respect the go.mod
file and fetch the correct version. Gandalf utilizes go modules to pin dependency versions,
go get
will download the latest version of a dependency rather than the version a project actually supports where as something like go mod download
will respect the go.mod
file and fetch the correct version. The mmock project has changed its package structure making newer versions of it not backwards compatible. mmock 项目已更改其 package 结构,使其更新版本不向后兼容。
I recommend getting antiquated with go modules as they seem to be the way forward now and have been enabled by default in newer versions of the go compiler.我建议使用 go 模块过时,因为它们现在似乎是前进的方向,并且在 go 编译器的较新版本中默认启用。 If I remember correctly you may already have support for it you just need to set the environment variable
GO111MODULE=on
when dealing with projects that have a go.mod
file.如果我没记错的话,您可能已经支持它,您只需要在处理具有
go.mod
文件的项目时设置环境变量GO111MODULE=on
即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.