Code cleanups

pull/5757/head
Jason Wilder 2016-02-22 15:05:15 -07:00
parent a2d3d44505
commit 6f39b355bc
3 changed files with 5 additions and 7 deletions

View File

@ -82,7 +82,7 @@ enabled = true
} else if c.ContinuousQuery.Enabled != true {
t.Fatalf("unexpected continuous query enabled: %v", c.ContinuousQuery.Enabled)
} else if exp, got := "foo:123,bar:456", c.Join; exp != got {
t.Fatalf("unexpected join value: exp %v, got %v", exp, got)
t.Fatalf("unexpected join value: got %v, exp %v", got, exp)
}
}
@ -163,7 +163,7 @@ enabled = false
}
if e := c.Validate(); e == nil {
t.Fatalf("expected error, got nil")
t.Fatalf("got nil, expected error")
}
}
@ -183,6 +183,6 @@ enabled = false
}
if err := c.Validate(); err == nil {
t.Fatalf("expected error, got nil")
t.Fatalf("got nil, expected error")
}
}

View File

@ -838,8 +838,7 @@ func (c *Client) JoinMetaServer(httpAddr, tcpAddr string) (*NodeInfo, error) {
// Successfully joined
if resp.StatusCode == http.StatusOK {
defer resp.Body.Close()
dec := json.NewDecoder(resp.Body)
if err := dec.Decode(&node); err != nil {
if err := json.NewDecoder(resp.Body).Decode(&node); err != nil {
return nil, err
}
break

View File

@ -166,8 +166,7 @@ func (h *handler) serveExec(w http.ResponseWriter, r *http.Request) {
// Return the node with newly assigned ID as json
w.Header().Add("Content-Type", "application/json")
enc := json.NewEncoder(w)
if err := enc.Encode(node); err != nil {
if err := json.NewEncoder(w).Encode(node); err != nil {
h.httpError(err, w, http.StatusInternalServerError)
}