Skip to content

Cannot compile lvm-localpv #415

@jochenseeber

Description

@jochenseeber

What steps did you take and what happened:

I was trying to take a stab at #259 (RAID support), but am not able to compile the code.

What I did:

  • Checked out project
  • Added a file .tool-versions with entry golang 1.19.13 (I'm using asdf)
  • Ran make bootstrap
  • Ran make

Encountered the following errors:

❯ make
--> Running golint
golangci-lint run -E exportloopref,dupl,revive,bodyclose,goconst,misspell -D structcheck --timeout 5m0s
pkg/apis/openebs.io/lvm/v1alpha1/register.go:73:3: cannot use &LVMVolume{} (value of type *LVMVolume) as "k8s.io/apimachinery/pkg/runtime".Object value in argument to scheme.AddKnownTypes: *LVMVolume does not implement "k8s.io/apimachinery/pkg/runtime".Object (missing method GetObjectKind) (typecheck)
                &LVMVolume{},
                ^
pkg/apis/openebs.io/lvm/v1alpha1/register.go:74:3: cannot use &LVMVolumeList{} (value of type *LVMVolumeList) as "k8s.io/apimachinery/pkg/runtime".Object value in argument to scheme.AddKnownTypes: *LVMVolumeList does not implement "k8s.io/apimachinery/pkg/runtime".Object (missing method GetObjectKind) (typecheck)
                &LVMVolumeList{},
                ^
pkg/apis/openebs.io/lvm/v1alpha1/register.go:75:3: cannot use &LVMSnapshot{} (value of type *LVMSnapshot) as "k8s.io/apimachinery/pkg/runtime".Object value in argument to scheme.AddKnownTypes: *LVMSnapshot does not implement "k8s.io/apimachinery/pkg/runtime".Object (missing method GetObjectKind) (typecheck)
                &LVMSnapshot{},
                ^
pkg/apis/openebs.io/lvm/v1alpha1/register.go:76:3: cannot use &LVMSnapshotList{} (value of type *LVMSnapshotList) as "k8s.io/apimachinery/pkg/runtime".Object value in argument to scheme.AddKnownTypes: *LVMSnapshotList does not implement "k8s.io/apimachinery/pkg/runtime".Object (missing method GetObjectKind) (typecheck)
                &LVMSnapshotList{},
                ^
pkg/apis/openebs.io/lvm/v1alpha1/register.go:77:3: cannot use &LVMNode{} (value of type *LVMNode) as "k8s.io/apimachinery/pkg/runtime".Object value in argument to scheme.AddKnownTypes: *LVMNode does not implement "k8s.io/apimachinery/pkg/runtime".Object (missing method GetObjectKind) (typecheck)
                &LVMNode{},
                ^
pkg/apis/openebs.io/lvm/v1alpha1/register.go:78:3: cannot use &LVMNodeList{} (value of type *LVMNodeList) as "k8s.io/apimachinery/pkg/runtime".Object value in argument to scheme.AddKnownTypes: *LVMNodeList does not implement "k8s.io/apimachinery/pkg/runtime".Object (missing method GetObjectKind) (typecheck)
                &LVMNodeList{},
                ^
pkg/apis/openebs.io/lvm/v1alpha1/zz_generated.deepcopy.go:56:10: cannot use c (variable of type *LVMNode) as "k8s.io/apimachinery/pkg/runtime".Object value in return statement: *LVMNode does not implement "k8s.io/apimachinery/pkg/runtime".Object (missing method GetObjectKind) (typecheck)
                return c
                       ^
pkg/apis/openebs.io/lvm/v1alpha1/zz_generated.deepcopy.go:89:10: cannot use c (variable of type *LVMNodeList) as "k8s.io/apimachinery/pkg/runtime".Object value in return statement: *LVMNodeList does not implement "k8s.io/apimachinery/pkg/runtime".Object (missing method GetObjectKind) (typecheck)
                return c
                       ^
pkg/apis/openebs.io/lvm/v1alpha1/zz_generated.deepcopy.go:117:10: cannot use c (variable of type *LVMSnapshot) as "k8s.io/apimachinery/pkg/runtime".Object value in return statement: *LVMSnapshot does not implement "k8s.io/apimachinery/pkg/runtime".Object (missing method GetObjectKind) (typecheck)
                return c
                       ^
pkg/apis/openebs.io/lvm/v1alpha1/zz_generated.deepcopy.go:150:10: cannot use c (variable of type *LVMSnapshotList) as "k8s.io/apimachinery/pkg/runtime".Object value in return statement: *LVMSnapshotList does not implement "k8s.io/apimachinery/pkg/runtime".Object (missing method GetObjectKind) (typecheck)
                return c
                       ^
pkg/apis/openebs.io/lvm/v1alpha1/zz_generated.deepcopy.go:194:10: cannot use c (variable of type *LVMVolume) as "k8s.io/apimachinery/pkg/runtime".Object value in return statement: *LVMVolume does not implement "k8s.io/apimachinery/pkg/runtime".Object (missing method GetObjectKind) (typecheck)
                return c
                       ^
pkg/apis/openebs.io/lvm/v1alpha1/zz_generated.deepcopy.go:227:10: cannot use c (variable of type *LVMVolumeList) as "k8s.io/apimachinery/pkg/runtime".Object value in return statement: *LVMVolumeList does not implement "k8s.io/apimachinery/pkg/runtime".Object (missing method GetObjectKind) (typecheck)
                return c
                       ^
pkg/generated/clientset/internalclientset/typed/lvm/v1alpha1/fake/fake_lvmnode.go:45:3: c.Fake.Invokes undefined (type *FakeLocalV1alpha1 has no field or method Invokes) (typecheck)
                Invokes(testing.NewGetAction(lvmnodesResource, c.ns, name), &v1alpha1.LVMNode{})
                ^
pkg/generated/clientset/internalclientset/typed/lvm/v1alpha1/fake/fake_lvmnode.go:56:3: c.Fake.Invokes undefined (type *FakeLocalV1alpha1 has no field or method Invokes) (typecheck)
                Invokes(testing.NewListAction(lvmnodesResource, lvmnodesKind, c.ns, opts), &v1alpha1.LVMNodeList{})
                ^
pkg/generated/clientset/internalclientset/typed/lvm/v1alpha1/fake/fake_lvmnode.go:78:3: c.Fake.InvokesWatch undefined (type *FakeLocalV1alpha1 has no field or method InvokesWatch) (typecheck)
                InvokesWatch(testing.NewWatchAction(lvmnodesResource, c.ns, opts))
                ^
pkg/generated/clientset/internalclientset/typed/lvm/v1alpha1/fake/fake_lvmnode.go:85:3: c.Fake.Invokes undefined (type *FakeLocalV1alpha1 has no field or method Invokes) (typecheck)
                Invokes(testing.NewCreateAction(lvmnodesResource, c.ns, lVMNode), &v1alpha1.LVMNode{})
                ^
pkg/generated/clientset/internalclientset/typed/lvm/v1alpha1/fake/fake_lvmsnapshot.go:78:3: c.Fake.InvokesWatch undefined (type *FakeLocalV1alpha1 has no field or method InvokesWatch) (typecheck)
                InvokesWatch(testing.NewWatchAction(lvmsnapshotsResource, c.ns, opts))
                ^
pkg/generated/clientset/internalclientset/typed/lvm/v1alpha1/fake/fake_lvmvolume.go:78:3: c.Fake.InvokesWatch undefined (type *FakeLocalV1alpha1 has no field or method InvokesWatch) (typecheck)
                InvokesWatch(testing.NewWatchAction(lvmvolumesResource, c.ns, opts))
                ^
pkg/generated/clientset/internalclientset/fake/clientset_generated.go:46:5: cs.AddReactor undefined (type *Clientset has no field or method AddReactor) (typecheck)
        cs.AddReactor("*", "*", testing.ObjectReaction(o))
           ^
pkg/generated/clientset/internalclientset/fake/clientset_generated.go:47:5: cs.AddWatchReactor undefined (type *Clientset has no field or method AddWatchReactor) (typecheck)
        cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
           ^
pkg/driver/agent.go:36:2: could not import golang.org/x/net/context (-: cannot compile Go 1.23 code) (typecheck)
        "golang.org/x/net/context"
        ^
pkg/driver/agent.go:37:2: could not import golang.org/x/sys/unix (-: cannot compile Go 1.23 code) (typecheck)
        "golang.org/x/sys/unix"
        ^
pkg/driver/controller.go:339:6: vol declared and not used (typecheck)
        var vol *lvmapi.LVMVolume
            ^
pkg/lvm/mount.go:73:14: undefined: mount (typecheck)
        mounter := &mount.SafeFormatAndMount{Interface: mount.New(""), Exec: utilexec.New()}
                    ^
pkg/lvm/mount.go:97:14: undefined: mount (typecheck)
        mounter := &mount.SafeFormatAndMount{Interface: mount.New(""), Exec: utilexec.New()}
                    ^
pkg/lvm/mount.go:99:19: undefined: mount (typecheck)
        dev, ref, err := mount.GetDeviceNameFromMount(mounter, targetPath)
                         ^
make: *** [Makefile:274: golint] Error 1

What did you expect to happen:

  • Ready madę and shiny new lvm-localpv containers

Anything else you would like to add:

  • I'm new to Golang, but I was wondering why the project was using Go 1.19, while some dependencies have Go 1.23 specified in their go.mod (e.g. golang.org/x/net/context)
  • Same thing happens when I try to use nix-shell

Environment:

  • LVM version: 2.03.31(2)
  • Kubernetes version (use kubectl version): v1.34.0
  • Kubernetes installer & version: minikube v1.37.0 on Debian 13.1 (arm64)
  • Cloud provider or hardware configuration: UTM virtual machine
  • OS (e.g. from /etc/os-release): Debian 13 (trixie)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions