same vendor code from multiple packages

487 Views Asked by At

I'm trying to use grpc "google.golang.org/grpc" package.

import (
    "github.com/xxxx/yyyy"
    "google.golang.org/grpc"
)

conn, err := grpc.Dial(address)
pppp.NewXXXXClient(conn) // where pppp is from github.com/xxxx/yyyy

What happens if github.com/xxxx/yyyy also vendors the same grpc package? I am getting a compilation error like below

cannot use conn (type *"google.golang.org/grpc".ClientConn) as type
*"github.com/xxxx/yyyy/vendor/google.golang.org/grpc".ClientConn

How can I get around this?

1

There are 1 best solutions below

0
On

I think, you must vendor every dependency of your project (if necessary - include Go std library too), or you shouldn't use vendoring at all. There's no third choise.