From 8e98ee44b21ef0f8d441a6d7760a78afb9c57e1a Mon Sep 17 00:00:00 2001 From: inosato Date: Sat, 1 May 2021 12:23:46 +0900 Subject: [PATCH] Stop using io/ioutil --- client/nginx.go | 4 ++-- exporter.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/client/nginx.go b/client/nginx.go index c186634b..01a66ebc 100644 --- a/client/nginx.go +++ b/client/nginx.go @@ -2,7 +2,7 @@ package client import ( "fmt" - "io/ioutil" + "io" "net/http" "strconv" "strings" @@ -53,7 +53,7 @@ func (client *NginxClient) GetStubStats() (*StubStats, error) { return nil, fmt.Errorf("expected %v response, got %v", http.StatusOK, resp.StatusCode) } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, fmt.Errorf("failed to read the response body: %v", err) } diff --git a/exporter.go b/exporter.go index 50271baa..251a31cc 100644 --- a/exporter.go +++ b/exporter.go @@ -6,7 +6,6 @@ import ( "crypto/x509" "flag" "fmt" - "io/ioutil" "log" "net" "net/http" @@ -327,7 +326,7 @@ func main() { sslConfig := &tls.Config{InsecureSkipVerify: !*sslVerify} if *sslCaCert != "" { - caCert, err := ioutil.ReadFile(*sslCaCert) + caCert, err := os.ReadFile(*sslCaCert) if err != nil { log.Fatalf("Loading CA cert failed: %v", err) }