使用其他项目的供应商?

时间:2016-09-15 20:37:29

标签: go govendor

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

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和#34;代码"正确对待供应商目录?我在这做错了什么?

代码示例:

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)
...

它抱怨标志被错误使用。

0 个答案:

没有答案