Re: [go-nuts] multiple vendor path for same type

2020-05-15 Thread Ian Lance Taylor
On Fri, May 15, 2020 at 10:04 AM Nobin Mathew  wrote:
>
> I am almost new to golang, sorry if I am asking some silly question.
>
> I am facing some compilation issue due to type conflict
>
> **
>
> +++ [0515 07:51:26] Building go targets for linux/amd64:
> test/e2e/e2e.test
> # k8s.io/kubernetes/test/e2e/framework
> test/e2e/framework/framework.go:239:44: cannot use config (type 
> *"k8s.io/kubernetes/vendor/k8s.io/client-go/rest".Config) as type 
> *"k8s.io/kubernetes/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/vendor/k8s.io/client-go/rest".Config
>  in argument to 
> "k8s.io/kubernetes/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1".NewForConfig
> test/e2e/framework/framework_multus.go:14:3: cannot use 
> "k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1".ObjectMeta 
> literal (type 
> "k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1".ObjectMeta) 
> as type 
> "k8s.io/kubernetes/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/vendor/k8s.io/apimachinery/pkg/apis/meta/v1".ObjectMeta
>  in field value
> !!! [0515 07:51:30] Call tree:
> !!! [0515 07:51:30]  1: 
> /home/eccd/go/src/k8s.io/kubernetes/hack/lib/golang.sh:853 
> kube::golang::build_binaries_for_platform(...)
> !!! [0515 07:51:30]  2: hack/make-rules/build.sh:27 
> kube::golang::build_binaries(...)
> !!! [0515 07:51:30] Call tree:
> !!! [0515 07:51:30]  1: hack/make-rules/build.sh:27 
> kube::golang::build_binaries(...)
> !!! [0515 07:51:30] Call tree:
> !!! [0515 07:51:30]  1: hack/make-rules/build.sh:27 
> kube::golang::build_binaries(...)
> make: *** [Makefile:93: all] Error 1
>
> ***
>
> I Included a library
>
> "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1"
>
> in kubernetes (this is for some internal development, kubernetes guys wont 
> like it :) )
>
>
>
> if you look at line number 239:44 error, there is type conflict but it is 
> actually pointing to same struct.
> Expecting is
> "k8s.io/kubernetes/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/vendor/k8s.io/client-go/rest".Config"
>
> but provided "k8s.io/kubernetes/vendor/k8s.io/client-go/rest".Config"
>
> But if you look at what is after "vendor", both are same i.e. 
> "k8s.io/client-go/rest".Config"
>
>
>
> How can I solve this problem. I any help or pointers will be helpful(any 
> directions to read).

In Go, types are distinguished by the import path used to find the type.

In this case, it looks like you have the same package at two different
positions in your source tree.  Go will treat the types defined in
those two different packages as different types.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcV%3DZ5ddVWH9ci3txv-pR6ffApsdOv9%3DZg_wGPbrrzDQ8g%40mail.gmail.com.


[go-nuts] multiple vendor path for same type

2020-05-15 Thread Nobin Mathew
Hi all,

I am almost new to golang, sorry if I am asking some silly question. 

I am facing some compilation issue due to type conflict

**

+++ [0515 07:51:26] Building go targets for linux/amd64:
test/e2e/e2e.test
# k8s.io/kubernetes/test/e2e/framework
test/e2e/framework/framework.go:239:44: cannot use config (type 
*"k8s.io/kubernetes/vendor/k8s.io/client-go/rest".Config) as type 
*"k8s.io/kubernetes/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/vendor/k8s.io/client-go/rest".Config
 
in argument to 
"k8s.io/kubernetes/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1".NewForConfig
test/e2e/framework/framework_multus.go:14:3: cannot use 
"k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1".ObjectMeta 
literal (type 
"k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1".ObjectMeta) 
as type 
"k8s.io/kubernetes/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/vendor/k8s.io/apimachinery/pkg/apis/meta/v1".ObjectMeta
 
in field value
!!! [0515 07:51:30] Call tree:
!!! [0515 07:51:30]  1: 
/home/eccd/go/src/k8s.io/kubernetes/hack/lib/golang.sh:853 
kube::golang::build_binaries_for_platform(...)
!!! [0515 07:51:30]  2: hack/make-rules/build.sh:27 
kube::golang::build_binaries(...)
!!! [0515 07:51:30] Call tree:
!!! [0515 07:51:30]  1: hack/make-rules/build.sh:27 
kube::golang::build_binaries(...)
!!! [0515 07:51:30] Call tree:
!!! [0515 07:51:30]  1: hack/make-rules/build.sh:27 
kube::golang::build_binaries(...)
make: *** [Makefile:93: all] Error 1

***

I Included a library  

"github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1"

in kubernetes (this is for some internal development, kubernetes guys wont like 
it :) )



if you look at line number 239:44 error, there is type conflict but it is 
actually pointing to same struct.
Expecting is 
"k8s.io/kubernetes/vendor/github.com/k8snetworkplumbingwg/network-attachment-definition-client/vendor/k8s.io/client-go/rest".Config"

but provided "k8s.io/kubernetes/vendor/k8s.io/client-go/rest".Config" 

But if you look at what is after "vendor", both are same i.e. 
"k8s.io/client-go/rest".Config"



How can I solve this problem. I any help or pointers will be helpful(any 
directions to read).


-Nobin

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/e74cec82-1bd9-45db-b373-25277f7678ac%40googlegroups.com.