From c48fadc4a7655008d13076c7f757c36368e2ca13 Mon Sep 17 00:00:00 2001 From: KallyDev <36319157+kallydev@users.noreply.github.com> Date: Thu, 30 Sep 2021 01:17:48 +0800 Subject: Move from deprecated ioutil to os and io packages (#4364) --- modules/caddyhttp/reverseproxy/healthchecks.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'modules/caddyhttp/reverseproxy/healthchecks.go') diff --git a/modules/caddyhttp/reverseproxy/healthchecks.go b/modules/caddyhttp/reverseproxy/healthchecks.go index 8d5bd77..230bf3a 100644 --- a/modules/caddyhttp/reverseproxy/healthchecks.go +++ b/modules/caddyhttp/reverseproxy/healthchecks.go @@ -18,7 +18,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "log" "net" "net/http" @@ -282,7 +281,7 @@ func (h *Handler) doActiveHealthCheck(dialInfo DialInfo, hostAddr string, host H } defer func() { // drain any remaining body so connection could be re-used - _, _ = io.Copy(ioutil.Discard, body) + _, _ = io.Copy(io.Discard, body) resp.Body.Close() }() @@ -313,7 +312,7 @@ func (h *Handler) doActiveHealthCheck(dialInfo DialInfo, hostAddr string, host H // if body does not match regex, mark down if h.HealthChecks.Active.bodyRegexp != nil { - bodyBytes, err := ioutil.ReadAll(body) + bodyBytes, err := io.ReadAll(body) if err != nil { h.HealthChecks.Active.logger.Info("failed to read response body", zap.String("host", hostAddr), -- cgit v1.2.3