Skip to content

Commit

Permalink
chore: remove refs to deprecated io/ioutil
Browse files Browse the repository at this point in the history
Signed-off-by: guoguangwu <guoguangwug@gmail.com>
  • Loading branch information
testwill committed May 9, 2024
1 parent 2e60c05 commit c23688c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions kafka_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"crypto/x509"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -216,7 +215,7 @@ func NewExporter(opts kafkaOpts, topicFilter string, topicExclude string, groupF
}

if opts.tlsCAFile != "" {
if ca, err := ioutil.ReadFile(opts.tlsCAFile); err == nil {
if ca, err := os.ReadFile(opts.tlsCAFile); err == nil {
config.Net.TLS.Config.RootCAs = x509.NewCertPool()
config.Net.TLS.Config.RootCAs.AppendCertsFromPEM(ca)
} else {
Expand Down Expand Up @@ -939,7 +938,7 @@ func setup(

certPool := x509.NewCertPool()
if opts.serverTlsCAFile != "" {
if caCert, err := ioutil.ReadFile(opts.serverTlsCAFile); err == nil {
if caCert, err := os.ReadFile(opts.serverTlsCAFile); err == nil {
certPool.AppendCertsFromPEM(caCert)
} else {
klog.Error("error reading server ca")
Expand Down
4 changes: 2 additions & 2 deletions simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"errors"
"io/ioutil"
"io"
"log"
"net/http"
"testing"
Expand All @@ -27,7 +27,7 @@ func TestSmoke(t *testing.T) {
log.Println(resp.Status)

defer resp.Body.Close()
bytes, err := ioutil.ReadAll(resp.Body)
bytes, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatalln(err)
} else {
Expand Down

0 comments on commit c23688c

Please sign in to comment.