0

我将其他项目(Origin)供应商目录用于小型应用程序(因为他们使用旧版本的库并且它与当前版本不兼容)。但我得到这些错误:

argument to kclient.Namespaces().List                                                                                                                                                                           
[mangis@mj origin-goclient-example]$ go build                                                                                                                                                                  
# github.com/mangirdaz/origin-goclient-example                                                                                                                                                                 
./main.go:15: cannot use &flags (type *"github.com/mangirdaz/origin-goclient-example/vendor/github.com/spf13/pflag".FlagSet) as type *"github.com/openshift/origin/vendor/github.com/spf13/pflag".FlagSet in ar
gument to "github.com/openshift/origin/pkg/cmd/util/clientcmd".New                                                                                                                                             
./main.go:29: cannot use "github.com/mangirdaz/origin-goclient-example/vendor/k8s.io/kubernetes/pkg/api".ListOptions literal (type "github.com/mangirdaz/origin-goclient-example/vendor/k8s.io/kubernetes/pkg/a
pi".ListOptions) as type "github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/api".ListOptions in argument to osclient.Projects().List                                                                    
./main.go:37: cannot use "github.com/mangirdaz/origin-goclient-example/vendor/k8s.io/kubernetes/pkg/api".ListOptions literal (type "github.com/mangirdaz/origin-goclient-example/vendor/k8s.io/kubernetes/pkg/a
pi".ListOptions) as type "github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/api".ListOptions in argument to osclient.BuildConfigs("my-project").List                                                    
./main.go:45: cannot use "github.com/mangirdaz/origin-goclient-example/vendor/k8s.io/kubernetes/pkg/api".ListOptions literal (type "github.com/mangirdaz/origin-goclient-example/vendor/k8s.io/kubernetes/pkg/a
pi".ListOptions) as type "github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/api".ListOptions in argument to kclient.Pods("my-project").List                                                             
./main.go:56: cannot use "github.com/mangirdaz/origin-goclient-example/vendor/k8s.io/kubernetes/pkg/api".ListOptions literal (type "github.com/mangirdaz/origin-goclient-example/vendor/k8s.io/kubernetes/pkg/a
pi".ListOptions) as type "github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/api".ListOptions in argument to kclient.Namespaces().List  

如何使 govendor 和“代码”正确对待供应商目录?我在这里做错了什么?

代码示例:

import (
    "fmt"
    "log"

    flag "github.com/spf13/pflag"

    "github.com/openshift/origin/pkg/cmd/util/clientcmd"
    kapi "k8s.io/kubernetes/pkg/api"
)

func main() {
    flags := flag.FlagSet{}
    factory := clientcmd.New(&flags)
...

它抱怨错误使用标志。

4

0 回答 0