Some of our users faced an issue while trying to run the Go client. I did some analysis about the issue to find the actual cause. What I found is that if you are trying to build the goclient outside the dgraph repo, say I try it in
$GOPATH/src/github.com/pawanrawal/someapp, I get the error
./main.go:55: cannot use conn (type *"google.golang.org/grpc".ClientConn) as type *"github.com/dgraph-io/dgraph/vendor/google.golang.org/grpc".ClientConn in argument to graph.NewDgraphClient ./main.go:122: cannot use conn (type *"google.golang.org/grpc".ClientConn) as type *"github.com/dgraph-io/dgraph/vendor/google.golang.org/grpc".ClientConn in argument to graph.NewDgraphClient
What happens here is that Go can’t figure out that the grpc version in my
GOPATH and that in the vendor directory of Dgraph repo is the same. Hence this error. A version of the similar issue has been faced by other users too
So when our users try to do a
go get -v github.com/dgraph-io/dgraph/query/graph, the vendored versions are of grpc and context package are downloaded as you can see below because they are vendored in.
github.com/dgraph-io/dgraph/vendor/golang.org/x/net/context github.com/dgraph-io/dgraph/vendor/golang.org/x/net/trace github.com/dgraph-io/dgraph/vendor/google.golang.org/grpc/credentials github.com/dgraph-io/dgraph/vendor/google.golang.org/grpc/metadata github.com/dgraph-io/dgraph/vendor/google.golang.org/grpc/stats github.com/dgraph-io/dgraph/vendor/google.golang.org/grpc/tap github.com/dgraph-io/dgraph/vendor/google.golang.org/grpc/peer github.com/dgraph-io/dgraph/vendor/google.golang.org/grpc/transport github.com/dgraph-io/dgraph/vendor/google.golang.org/grpc github.com/dgraph-io/dgraph/query/graph
And now go build would cause an error if you try to use the Go client. The only solution I found for this was to not vendor in the grpc package, so that while downloading the graph package, the actual grpc package is downloaded and not the vendored version. What do you think @minions?