From 466927ce684343c65198b204716efcb029f1496a Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Tue, 26 Sep 2017 12:12:29 +0100 Subject: [PATCH] lint: Fix 2 sites failing a recently introduced golint check golint has gained a new check and we don't freeze the golint version so CI was failing on unrelated PRs: app/multitenant/consul_client.go:69:2: redundant if ...; err != nil check, just return error instead. report/marshal.go:188:2: redundant if ...; err != nil check, just return error instead. Fix those! --- app/multitenant/consul_client.go | 5 +---- report/marshal.go | 7 +------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/app/multitenant/consul_client.go b/app/multitenant/consul_client.go index 3ac69d0b1..f893999a3 100644 --- a/app/multitenant/consul_client.go +++ b/app/multitenant/consul_client.go @@ -66,10 +66,7 @@ func (c *consulClient) Get(key string, out interface{}) error { if kvp == nil { return ErrNotFound } - if err := json.NewDecoder(bytes.NewReader(kvp.Value)).Decode(out); err != nil { - return err - } - return nil + return json.NewDecoder(bytes.NewReader(kvp.Value)).Decode(out) } // CAS atomically modify a value in a callback. diff --git a/report/marshal.go b/report/marshal.go index 36c7d2d0d..cebcd0b76 100644 --- a/report/marshal.go +++ b/report/marshal.go @@ -185,12 +185,7 @@ func (rep *Report) WriteToFile(path string, compressionLevel int) error { w = gzwriter } - if err = codec.NewEncoder(w, handle).Encode(rep); err != nil { - return err - } - - return nil - + return codec.NewEncoder(w, handle).Encode(rep) } func handlerFromFileType(path string) (codec.Handle, bool, error) {