You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem is clientv3.KV interface has golang.org/x/net/context type as first arguments to methods. If a project vendors github.com/coreos/clientv3 and its own golang.org/x/net/context, clientv3/namespace won't compile because of different import paths
./etcd_embedded_test.go:63: cannot use cli.KV (type "github.com/coreos/etcdlabs/vendor/github.com/coreos/etcd/clientv3".KV) as type "github.com/coreos/etcd/clientv3".KV in argument to namespace.NewKV:
"github.com/coreos/etcdlabs/vendor/github.com/coreos/etcd/clientv3".KV does not implement "github.com/coreos/etcd/clientv3".KV (wrong type for Compact method)
have Compact("github.com/coreos/etcdlabs/vendor/golang.org/x/net/context".Context, int64, ..."github.com/coreos/etcdlabs/vendor/github.com/coreos/etcd/clientv3".CompactOption) (*"github.com/coreos/etcdlabs/vendor/github.com/coreos/etcd/clientv3".CompactResponse, error)
want Compact("golang.org/x/net/context".Context, int64, ..."github.com/coreos/etcd/clientv3".CompactOption) (*"github.com/coreos/etcd/clientv3".CompactResponse, error)
./etcd_embedded_test.go:63: cannot use namespace.NewKV(cli.KV, "prefix") (type "github.com/coreos/etcd/clientv3".KV) as type "github.com/coreos/etcdlabs/vendor/github.com/coreos/etcd/clientv3".KV in assignment:
"github.com/coreos/etcd/clientv3".KV does not implement "github.com/coreos/etcdlabs/vendor/github.com/coreos/etcd/clientv3".KV (wrong type for Compact method)
have Compact("golang.org/x/net/context".Context, int64, ..."github.com/coreos/etcd/clientv3".CompactOption) (*"github.com/coreos/etcd/clientv3".CompactResponse, error)
want Compact("github.com/coreos/etcdlabs/vendor/golang.org/x/net/context".Context, int64, ..."github.com/coreos/etcdlabs/vendor/github.com/coreos/etcd/clientv3".CompactOption) (*"github.com/coreos/etcdlabs/vendor/github.com/coreos/etcd/clientv3".CompactResponse, error)
FAIL github.com/coreos/etcdlabs/lru [build failed]
Without vendoring, same code runs fine.
Just open this for reference, if anyone faces the same issue.
The text was updated successfully, but these errors were encountered:
gyuho
changed the title
clientv3/namespace: cannot compile if the project vendors etcd/clientv3
clientv3/namespace: cannot compile if a project vendors clientv3 and 'x/net/context'
Apr 21, 2017
@tfzxyinhao Do you have example snippet to reproduce? Turns out I did not vendor clientv3/namespace correctly. After vendoring it, the code compiles fine. Other context import issues should be resolved with Go 1.9 type alias (e.g. https://go-review.googlesource.com/c/35671/2/context/go19.go)
Problem is
clientv3.KV
interface hasgolang.org/x/net/context
type as first arguments to methods. If a project vendorsgithub.com/coreos/clientv3
and its owngolang.org/x/net/context
,clientv3/namespace
won't compile because of different import pathse.g.
Copy this
Without vendoring, same code runs fine.
Just open this for reference, if anyone faces the same issue.
The text was updated successfully, but these errors were encountered: