我正在通过 golang 模块升级我的项目依赖项。冉
mod init
命令并遇到此问题,不知道如何解决。
$ go mod init
go: creating new go.mod: module github.com/GoogleContainerTools/kaniko
go: copying requirements from Gopkg.lock
go: converting Gopkg.lock: stat github.com/google/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="82e5edafe5ebf6eaf7e0c2f4b3baacb0acb2" rel="noreferrer noopener nofollow">[email protected]</a>: github.com/google/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e88f87c58f819c809d8aa89ed9d0c6dac6d8" rel="noreferrer noopener nofollow">[email protected]</a>: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v18
版本无效:模块包含 go.mod 文件,因此主版本必须兼容:应该是 v0 或 v1,而不是 v18
更新:
removed Gopkg.toml
go mod init
go build
fixed some dependencies related to HighwayHash
finally stuck on below error
go: github.com/moby/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f19384989d959a9885b187c1dfc7dfc2" rel="noreferrer noopener nofollow">[email protected]</a> requires
github.com/containerd/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="86e5e9e8f2e7efe8e3f4e2c6f0b7a8b5a8b6abb6a8b4b6b7bfb6b3b6b1b4b7b6bfb3bfabb1e5b7e3bebeb5bfbfe3e5b6" rel="noreferrer noopener nofollow">[email protected]</a>: invalid pseudo-version: version before v1.3.0 would have negative patch number
最佳答案
您正在使用的 containerd
提交似乎存在问题。您可以将其替换为可用的 containerd
版本或提交。
您可以通过将以下部分添加到您的 go.mod
文件中来实现此目的。
replace (
github.com/containerd/containerd v1.3.0-0.20190507210959-7c1e88399ec0 => github.com/containerd/containerd v1.3.0
)
如果您想在项目中获得最近的更改,可以使用以下内容代替上一节。
replace (
github.com/containerd/containerd v1.3.0-0.20190507210959-7c1e88399ec0 => github.com/containerd/containerd v1.3.1-0.20191118201915-499f346be357
)
引用:https://github.com/containerd/containerd/issues/3031#issuecomment-541737892
关于go - 通过模块升级golang,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58925619/