user16541053
user16541053

Reputation:

Go broken import

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/[email protected]/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/[email protected]/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.

Upvotes: 0

Views: 2298

Answers (1)

bcmills
bcmills

Reputation: 5187

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/[email protected] 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.

Upvotes: 1

Related Questions