From 747c8478c6b1e023246b6b91b68072b72a3f1036 Mon Sep 17 00:00:00 2001 From: Martin Martinez Rivera Date: Thu, 5 Dec 2019 15:56:53 -0800 Subject: [PATCH] Fix unhandled error warnings in x.go (#4366) --- x/x.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/x/x.go b/x/x.go index cf7f2025eb8..7af1d8f385b 100644 --- a/x/x.go +++ b/x/x.go @@ -299,7 +299,9 @@ func ReadLine(r *bufio.Reader, buf *bytes.Buffer) error { // over to our own buffer. line, isPrefix, err = r.ReadLine() if err == nil { - buf.Write(line) + if _, err := buf.Write(line); err != nil { + return err + } } } return err @@ -653,7 +655,9 @@ func GetDgraphClient(conf *viper.Viper, login bool) (*dgo.Dgraph, CloseFunc) { closeFunc := func() { for _, c := range conns { - c.Close() + if err := c.Close(); err != nil { + glog.Warningf("Error closing connection to Dgraph client: %v", err) + } } } return dg, closeFunc