出现了导入错误

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

Go broken import

问题

我正在尝试通过Go SDK与Helm进行交互,但在构建代码时遇到以下错误:

../../../go/pkg/mod/github.com/deislabs/oras@v0.11.1/pkg/oras/push.go:52:31: 调用remotes.PushContent时参数不足
        已有 (context.Context, remotes.Pusher, v1.Descriptor, "github.com/containerd/containerd/content".Store, nil, func(images.Handler) images.Handler)
        期望 (context.Context, remotes.Pusher, v1.Descriptor, "github.com/containerd/containerd/content".Store, *semaphore.Weighted, platforms.MatchComparer, func(images.Handler) images.Handler)

我追踪到了helm.sh/helm/v3/pkg/action包:

$ go get helm.sh/helm/v3/pkg/action
# github.com/deislabs/oras/pkg/oras
../../../go/pkg/mod/github.com/deislabs/oras@v0.11.1/pkg/oras/push.go:52:31: 调用remotes.PushContent时参数不足
        已有 (context.Context, remotes.Pusher, v1.Descriptor, "github.com/containerd/containerd/content".Store, nil, func(images.Handler) images.Handler)
        期望 (context.Context, remotes.Pusher, v1.Descriptor, "github.com/containerd/containerd/content".Store, *semaphore.Weighted, platforms.MatchComparer, func(images.Handler) images.Handler)

我怀疑这与这个更改有关:https://github.com/helm/helm/commit/663c5698878c959805de053116581d15673e1ce3

我该如何解决这个问题?我尝试使用旧版本的helm包,但没有成功。

英文:

I'm trying to interact with helm via the go SDK and I'm getting the following error when I try to build my code:

../../../go/pkg/mod/github.com/deislabs/oras@v0.11.1/pkg/oras/push.go:52:31: not enough arguments in call to remotes.PushContent
        have (context.Context, remotes.Pusher, v1.Descriptor, "github.com/containerd/containerd/content".Store, nil, func(images.Handler) images.Handler)
        want (context.Context, remotes.Pusher, v1.Descriptor, "github.com/containerd/containerd/content".Store, *semaphore.Weighted, platforms.MatchComparer, func(images.Handler) images.Handler)

I've traced it down to package helm.sh/helm/v3/pkg/action :

$ go get helm.sh/helm/v3/pkg/action
# github.com/deislabs/oras/pkg/oras
../../../go/pkg/mod/github.com/deislabs/oras@v0.11.1/pkg/oras/push.go:52:31: not enough arguments in call to remotes.PushContent
        have (context.Context, remotes.Pusher, v1.Descriptor, "github.com/containerd/containerd/content".Store, nil, func(images.Handler) images.Handler)
        want (context.Context, remotes.Pusher, v1.Descriptor, "github.com/containerd/containerd/content".Store, *semaphore.Weighted, platforms.MatchComparer, func(images.Handler) images.Handler)

I suspect that this is related to this change: https://github.com/helm/helm/commit/663c5698878c959805de053116581d15673e1ce3

How do I fix this? I've tried using older versions of the helm package to no avail.

答案1

得分: 1

github.com/containerd/containerd/remotes.PushContent的签名在commit f8c2f0中发生了不兼容的更改,该更改在v1.5.0中发布。(尽管containerd的Go API版本号为v1.5.5,但它似乎是不稳定的;请参阅containerd#3554)。

短期解决方法是通过go get -d github.com/containerd/containerd@v1.4将版本降级到最新的v1.4.*,直到您的依赖项与最新版本兼容为止。

长期解决方法似乎是helmcommit 663c56,它迁移到了一个与containerd v1.5 API兼容的不同的oras库。据我所知,该提交尚未包含在helm的发布版本中,但您可以尝试使用go get -d helm.sh/helm/v3/pkg/action@main进行测试;请参阅https://golang.org/doc/modules/managing-dependencies#repo_identifier。

英文:

The signature for github.com/containerd/containerd/remotes.PushContent was changed incompatibly in commit f8c2f0, which was released in v1.5.0. (The containerd Go API appears to be unstable, despite its apparently-semantic version v1.5.5; see containerd#3554.)

The short-term fix is to go get -d github.com/containerd/containerd@v1.4 to downgrade to the latest v1.4.* until your dependencies are compatible with the latest release.

The longer-term fix appears to be helm commit 663c56, which migrates to a different oras library whose latest release is compatible with the containerd v1.5 API. As far as I can tell that commit has not yet been included in a helm release, but you may be able to try it out using go get -d helm.sh/helm/v3/pkg/action@main; see https://golang.org/doc/modules/managing-dependencies#repo_identifier.

huangapple
  • 本文由 发表于 2021年7月28日 06:07:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/68552267.html
匿名

发表评论

匿名网友

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

确定