英文:
Cannot find 'fake' package from k8s.io/client-go
问题
我在我的go.mod文件中有以下依赖项:
require (
...
k8s.io/client-go v0.23.1
)
我删除了整个vendor文件夹,并尝试通过以下方式更新依赖项:
go mod tidy
go mod vendor
但是从下面的图片中可以看出,fake仍然不存在:
此外,从这里我可以看到'fake'包是存在的- https://github.com/kubernetes/client-go/tree/master/kubernetes
英文:
I have the dependency in my go.mod file like below:
require (
...
k8s.io/client-go v0.23.1
)
I deleted the entire vendor folder and tried updating the dependencies like this:
go mod tidy
go mod vendor
But still fake is not present as can be seen from the pic below:
Also from here i can see that the 'fake' pkg is present - https://github.com/kubernetes/client-go/tree/master/kubernetes
答案1
得分: 1
只需添加一个空白的导入语句,如下所示:
import (
_ "k8s.io/client-go/kubernetes/fake"
"k8s.io/client-go/discovery"
)
然后执行以下命令:
go mod vendor
你将看到期望的文件夹结构:
> ls vendor/k8s.io/client-go/kubernetes/
clientset.go doc.go fake import.go scheme typed
英文:
just add a blank import statement like:
import (
_ "k8s.io/client-go/kubernetes/fake"
"k8s.io/client-go/discovery"
)
and execute the command
go mod vendor
and you will see the expected folder
>ls vendor/k8s.io/client-go/kubernetes/
clientset.go doc.go fake import.go scheme typed
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论