Simplify string(buf.Bytes()) to buf.String() (#3590)

This commit is contained in:
Ryan Slade 2017-10-18 22:26:09 +02:00 committed by James Phillips
parent e6a4efa67b
commit 7d698c0a10
2 changed files with 3 additions and 3 deletions

View File

@ -252,7 +252,7 @@ func (k *KV) put(key string, params map[string]string, body []byte, q *WriteOpti
if _, err := io.Copy(&buf, resp.Body); err != nil { if _, err := io.Copy(&buf, resp.Body); err != nil {
return false, nil, fmt.Errorf("Failed to read response: %v", err) return false, nil, fmt.Errorf("Failed to read response: %v", err)
} }
res := strings.Contains(string(buf.Bytes()), "true") res := strings.Contains(buf.String(), "true")
return res, qm, nil return res, qm, nil
} }
@ -296,7 +296,7 @@ func (k *KV) deleteInternal(key string, params map[string]string, q *WriteOption
if _, err := io.Copy(&buf, resp.Body); err != nil { if _, err := io.Copy(&buf, resp.Body); err != nil {
return false, nil, fmt.Errorf("Failed to read response: %v", err) return false, nil, fmt.Errorf("Failed to read response: %v", err)
} }
res := strings.Contains(string(buf.Bytes()), "true") res := strings.Contains(buf.String(), "true")
return res, qm, nil return res, qm, nil
} }

View File

@ -196,7 +196,7 @@ func (op *Operator) AutopilotCASConfiguration(conf *AutopilotConfiguration, q *W
if _, err := io.Copy(&buf, resp.Body); err != nil { if _, err := io.Copy(&buf, resp.Body); err != nil {
return false, fmt.Errorf("Failed to read response: %v", err) return false, fmt.Errorf("Failed to read response: %v", err)
} }
res := strings.Contains(string(buf.Bytes()), "true") res := strings.Contains(buf.String(), "true")
return res, nil return res, nil
} }