使用 GO111MODULE 安装 buffalo 导致 go get: error loading module requirements

Installing buffalo with GO111MODULE results in go get: error loading module requirements

我在尝试安装 buffalo 时遇到错误。

我在 go version go1.12.7 linux/amd64 上使用一个干净的 GOPATH 进行了测试,其中没有任何内容。 GO111MODULE 设置为 on

我尝试使用网站上给出的命令安装 buffalo:

go get -u -v github.com/gobuffalo/buffalo/buffalo

执行命令导致 return 代码 1,详细输出末尾的错误消息似乎是 go get: error loading module requirements

不使用 -u 试试。这对我有用:

$ cd $(mktemp -d)
$ go mod init example.com/tempmod
$ go get github.com/gobuffalo/buffalo/buffalo

这些步骤对你有用吗?

更多关于 -u 来自 modules wiki:

A common mistake is thinking go get -u foo solely gets the latest version of foo. In actuality, the -u in go get -u foo or go get -u foo@latest means to also get the latest versions for all of the direct and indirect dependencies of foo. A common starting point when upgrading foo is instead to do go get foo or go get foo@latest without a -u (and after things are working, consider go get -u=patch foo, go get -u=patch, go get -u foo, or go get -u).

此外,对于您的原始命令,您很可能在输出的较早部分看到了更具体的错误。如果您 运行 没有 -v 来减少噪音,然后忽略 "finding"、"downloading" 和 "extracting" 消息,则那里可能存在更具体的错误。