Golang包依赖关系问题

ruarlubt  于 2023-01-15  发布在  Go
关注(0)|答案(1)|浏览(148)

我想在我的控制器www.example.com中使用以下函数https://github.com/openshift/machine-api-operator/blob/05041eaab5a6b9e22dd26df421d8d51050c39072/pkg/controller/vsphere/util.go#L221因此在我的代码中我执行以下导入

package controllers

import (
    "context"

    vsphere "github.com/openshift/machine-api-operator/pkg/controller"
    corev1 "k8s.io/api/core/v1"
    "k8s.io/apimachinery/pkg/types"
    "sigs.k8s.io/controller-runtime/pkg/client"
)

然而,当我去国防部整洁,我得到以下错误:

bitbucket.bit.admin.ch/BOSC/bosc-drs-vm-group-controller/controllers imports
        github.com/openshift/machine-api-operator/pkg/controller imports
        github.com/openshift/machine-api-operator/pkg/controller/machinehealthcheck imports
        sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1: module sigs.k8s.io/cluster-api@latest found (v1.3.2), but does not contain package sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1
bitbucket.bit.admin.ch/BOSC/bosc-drs-vm-group-controller/controllers imports
        github.com/openshift/machine-api-operator/pkg/controller imports
        github.com/openshift/machine-api-operator/pkg/controller/machinehealthcheck imports
        github.com/openshift/machine-api-operator/pkg/apis/healthchecking/v1alpha1 imports
        sigs.k8s.io/controller-runtime/pkg/runtime/scheme: module sigs.k8s.io/controller-runtime@latest found (v0.14.1), but does not contain package sigs.k8s.io/controller-runtime/pkg/runtime/scheme

似乎有一些依赖问题,但我不知道如何解决它们。我尝试在go.mod中设置sigs.k8s.io/controller-runtime引用分支而不是最新的,但似乎没有任何效果。

require (
    ...
)

require (
    ...
    sigs.k8s.io/cluster-api release-1.3 //indirect
    
)

我应该如何解决软件包依赖问题?

fkvaft9z

fkvaft9z1#

这是可行的:

go get github.com/openshift/machine-api-operator/pkg/controller/vsphere@master

该软件包在@latest release中不可用。

相关问题