Facing issue in using github.com/kedacore/keda/pkg/apis/keda/v1alpha1

85 Views Asked by At

I am using Keda along with client-go in golang. I am facing issue in getting the imported package

This is the error message

    go get github.com/kedacore/keda/pkg/apis/keda/v1alpha1
    go: downloading github.com/kedacore/keda v1.5.0
    go: github.com/kedacore/[email protected] requires
        github.com/operator-framework/[email protected]: invalid version: unknown revision 000000000000

To solve this, I did go get github.com/operator-framework/operator-sdk it got downloaded

Now I again tried go get github.com/kedacore/keda/pkg/apis/keda/v1alpha1 but still getting the same error message.

I tried

    go get github.com/operator-framework/[email protected]                                         
    go: github.com/operator-framework/[email protected]: invalid version: unknown revision 000000000000

I also tried go clean -modcache but the issue still remains the same.

Has anyone used keda go sdk and can suggest any idea on how to solve this?

2

There are 2 best solutions below

2
On

If you look at the repository you can find a file named go.mod. Inside this file you can see this line:

module github.com/kedacore/keda/v2

When you want to get that module, use module name specified in the go.mod file:

go get github.com/kedacore/keda/v2

Then inside your code you import the package you want as:

package main

import (

    "github.com/kedacore/keda/pkg/apis/keda/v1alpha1"
)

Hope this helps.

0
On

The issue happened due to importing incorrect package.

The correct package is "github.com/kedacore/keda/v2/apis/keda/v1alpha1" instead of "github.com/kedacore/keda/pkg/apis/keda/v1alpha1" Using this package solved my issue.