Skip to content

Commit

Permalink
chore: remove refs to deprecated io/ioutil
Browse files Browse the repository at this point in the history
  • Loading branch information
testwill committed Jul 13, 2023
1 parent 30861a9 commit 9c7b2b8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions exporter/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package exporter

import (
"fmt"
"io/ioutil"
"io"
"math/rand"
"net"
"net/http"
Expand Down Expand Up @@ -373,7 +373,7 @@ func downloadURLWithStatusCode(t *testing.T, u string) (int, string) {
t.Fatal(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
t.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions exporter/pwd_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package exporter

import (
"encoding/json"
"io/ioutil"
"os"

log "github.com/sirupsen/logrus"
)
Expand All @@ -12,7 +12,7 @@ func LoadPwdFile(passwordFile string) (map[string]string, error) {
res := make(map[string]string)

log.Debugf("start load password file: %s", passwordFile)
bytes, err := ioutil.ReadFile(passwordFile)
bytes, err := os.ReadFile(passwordFile)
if err != nil {
log.Warnf("load password file failed: %s", err)
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions exporter/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"os"

log "github.com/sirupsen/logrus"
)
Expand Down Expand Up @@ -111,7 +111,7 @@ func LoadKeyPair(certFile, keyFile string) (*tls.Certificate, error) {
// The file must contain PEM encoded data.
func LoadCAFile(caFile string) (*x509.CertPool, error) {
log.Debugf("Load CA cert file: %s", caFile)
pemCerts, err := ioutil.ReadFile(caFile)
pemCerts, err := os.ReadFile(caFile)
if err != nil {
return nil, err
}
Expand Down
3 changes: 1 addition & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"flag"
"io/ioutil"
"net/http"
"os"
"runtime"
Expand Down Expand Up @@ -140,7 +139,7 @@ func main() {
scripts := strings.Split(*scriptPath, ",")
ls = make(map[string][]byte, len(scripts))
for _, script := range scripts {
if ls[script], err = ioutil.ReadFile(script); err != nil {
if ls[script], err = os.ReadFile(script); err != nil {
log.Fatalf("Error loading script file %s err: %s", script, err)
}
}
Expand Down

0 comments on commit 9c7b2b8

Please sign in to comment.