From 7d698c0a10da7b71a6e98ff11e2ad938f29642de Mon Sep 17 00:00:00 2001 From: Ryan Slade Date: Wed, 18 Oct 2017 22:26:09 +0200 Subject: [PATCH] Simplify string(buf.Bytes()) to buf.String() (#3590) --- api/kv.go | 4 ++-- api/operator_autopilot.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/kv.go b/api/kv.go index 5990d3d13..97f515685 100644 --- a/api/kv.go +++ b/api/kv.go @@ -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 { 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 } @@ -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 { 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 } diff --git a/api/operator_autopilot.go b/api/operator_autopilot.go index 0fa9d1604..b179406dc 100644 --- a/api/operator_autopilot.go +++ b/api/operator_autopilot.go @@ -196,7 +196,7 @@ func (op *Operator) AutopilotCASConfiguration(conf *AutopilotConfiguration, q *W if _, err := io.Copy(&buf, resp.Body); err != nil { 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 }