From 2898735745bf6e0b017e3220b55e81eeaafda8b5 Mon Sep 17 00:00:00 2001 From: inosato <48383032+inosato@users.noreply.github.com> Date: Thu, 28 Jul 2022 22:14:50 +0900 Subject: [PATCH] Remove ioutil (#650) Signed-off-by: inosato --- mysqld_exporter.go | 3 +-- mysqld_exporter_test.go | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mysqld_exporter.go b/mysqld_exporter.go index d5a58f3a..ba5b054e 100644 --- a/mysqld_exporter.go +++ b/mysqld_exporter.go @@ -18,7 +18,6 @@ import ( "crypto/tls" "crypto/x509" "fmt" - "io/ioutil" "net/http" "os" "path" @@ -153,7 +152,7 @@ func parseMycnf(config interface{}) (string, error) { func customizeTLS(sslCA string, sslCert string, sslKey string) error { var tlsCfg tls.Config caBundle := x509.NewCertPool() - pemCA, err := ioutil.ReadFile(sslCA) + pemCA, err := os.ReadFile(sslCA) if err != nil { return err } diff --git a/mysqld_exporter_test.go b/mysqld_exporter_test.go index 7ad1837e..5a8ace72 100644 --- a/mysqld_exporter_test.go +++ b/mysqld_exporter_test.go @@ -16,7 +16,7 @@ package main import ( "context" "fmt" - "io/ioutil" + "io" "net" "net/http" "net/url" @@ -157,7 +157,7 @@ func TestBin(t *testing.T) { var err error binName := "mysqld_exporter" - binDir, err := ioutil.TempDir("/tmp", binName+"-test-bindir-") + binDir, err := os.MkdirTemp("/tmp", binName+"-test-bindir-") if err != nil { t.Fatal(err) } @@ -294,7 +294,7 @@ func getBody(urlToGet string) ([]byte, error) { } defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, err }