title: rpc error: code = Unavailable desc = connection closed in Go code
body: <p>I am working on <code>Dgraph</code> and <code>Go</code> integration.I am trying to access <code>Dgraph</code> query in <code>Go</code> and for that I am using <code>github.com/dgraph-io/dgo</code> library.</p>
  <p>Here is the code :</p>
  <pre><code>package main
  
  import (
      &quot;bytes&quot;
      &quot;context&quot;
      &quot;fmt&quot;
      &quot;io/ioutil&quot;
      &quot;log&quot;
  
      &quot;github.com/dgraph-io/dgo&quot;
      &quot;github.com/dgraph-io/dgo/protos/api&quot;
  
      &quot;google.golang.org/grpc&quot;
  )
  
  func main() {
  
       query := `{
           people(func: has(name)) {
              name
             follows{
               name
             }
           }
       }`
  
       conn, err := grpc.Dial(&quot;x.x.x.x:8000&quot;, grpc.WithInsecure())
       if err != nil {
            log.Fatal(err)
       }
       ctx := context.Background()
       dgraphClient := dgo.NewDgraphClient(api.NewDgraphClient(conn))
  
       txn := dgraphClient.NewTxn()
       txn.Query(ctx, query)
  
       request := &amp;api.Request{
            Query: query,
       }
  
       response, err := txn.Do(ctx, request)
       if err != nil {
            log.Fatal(err)
       }
       fmt.Println(string(response.Json))
  }
  </code></pre>
  <p>I am getting error <strong>rpc error: code = Unavailable desc = connection closed</strong> when I an trying to run code.
  As I am new to the <code>Go</code> and <code>DGraph Database</code> I have very limited knowledge.</p>
  <p>Can anyone please help what exact changes need to be done to fix this error.</p>