2

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/keda@v1.5.0 requires
        github.com/operator-framework/operator-sdk@v0.0.0-00010101000000-000000000000: 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/operator-sdk@v0.0.0-00010101000000-000000000000                                         
    go: github.com/operator-framework/operator-sdk@v0.0.0-00010101000000-000000000000: 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?

  • So what exactly is it that you need from keda, and why do you need v1alpha1 and can you do with v2 as well, because then this issue at least doesn't exist anymore --> go get github.com/kedacore/keda/v2 – Rick Rackow Aug 11 '23 at 15:30

2 Answers2

0

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.

  • Hi @Marko, Thanks for replying. I did as you suggested. Downloaded github.com/kedacore/keda/v2 Now when I try to build/execute my code it gives error no required module provides package github.com/kedacore/keda/pkg/apis/keda/v1alpha1; to add it: go get github.com/kedacore/keda/pkg/apis/keda/v1alpha1 When I try to get the package mentioned, I am back to the same problem. – Shiva Raman Pandey Aug 11 '23 at 14:56
  • 1
    How can just getting the module provide the package defined inside? – Shiva Raman Pandey Aug 11 '23 at 15:04
-2

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.