Rpc error: code = Unknown desc = Empty query

Hi , i use this code for connect and run query with go .
but show this error :
2019/09/03 17:33:47 rpc error: code = Unknown desc = Empty query
exit status 1

code :

package main

import (


func main() {
	conn, err := grpc.Dial("", grpc.WithInsecure())
	if err != nil {
	defer conn.Close()
	dgraphClient := dgo.NewDgraphClient(api.NewDgraphClient(conn))
	ctx := context.Background()

	txn := dgraphClient.NewTxn()
	defer txn.Discard(ctx)

	variables := map[string]string{
		"$name": "mhb8898",

	q := `query name($name: string)
    name(func : allofterms(UrlName , $name)){

	resp, err := txn.QueryWithVars(ctx, q, variables)
	if err != nil {

Can you help me ???!

You might have a version mismatch, take a look at: https://github.com/dgraph-io/dgo/issues/82

How to install dgo v1 ??
in this issues write this link : github.com/dgraph-io/dgo
and i install this dgo and my version dgraph v1.0.17
and in github dgo :
Note, dgo 1.0.0 works with dgraph 1.0.x only
Note, dgo 2.0.0 works with dgraph 1.1.x only
go get -u -v github.com/dgraph-io/dgo

i use this go get for install …
is it v1?


go get -u -v github.com/dgraph-io/dgo/v1

or go to
And do a git checkout to V1

git checkout dgraph/release/v1.0

Now i use dgraph latest in docker compose and dgo v1
it’s work !!!

This is certainly v1.1.0 so you should use Dgo v2.