sebidude / kubecrypt

Helper for dealing with secrets in kubernetes.
MIT License
23 stars 2 forks source link

error when compiling with go 1.15.5 #6

Closed thorko closed 3 years ago

thorko commented 3 years ago

I get the following error when compiling with go version 1.15.5

# github.com/sebidude/kubecrypt/kube
/opt/go/src/github.com/sebidude/kubecrypt/kube/kube.go:21:60: not enough arguments in call to clientset.CoreV1().Secrets(namespace).List
        have ("k8s.io/apimachinery/pkg/apis/meta/v1".ListOptions)
        want (context.Context, "k8s.io/apimachinery/pkg/apis/meta/v1".ListOptions)
/opt/go/src/github.com/sebidude/kubecrypt/kube/kube.go:79:56: not enough arguments in call to clientset.CoreV1().Secrets(namespace).Create
        have (*"k8s.io/api/core/v1".Secret)
        want (context.Context, *"k8s.io/api/core/v1".Secret, "k8s.io/apimachinery/pkg/apis/meta/v1".CreateOptions)

Seems to be the arguments in the interface "SecretInterface" have been changed

type SecretInterface interface {
    Create(ctx context.Context, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error)
    Update(ctx context.Context, secret *v1.Secret, opts metav1.UpdateOptions) (*v1.Secret, error)
    Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
    DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
    Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Secret, error)
    List(ctx context.Context, opts metav1.ListOptions) (*v1.SecretList, error)
    Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
    Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Secret, err error)
    SecretExpansion
}
sebidude commented 3 years ago

Indeed. But this is related to an dependency update. I guess that you updated the client-go in the go.mod to some newer version.

Anyway, I ran a test with the go.mod to use go 1.15 and the kubernetes client libs for kubernetes 1.19 and it's working. I will update the code to use go 1.15 and client-go for kubernetes 1.19