diff --git a/admin.go b/admin.go index 1d8ed20..ca685c3 100644 --- a/admin.go +++ b/admin.go @@ -4,7 +4,6 @@ import ( "encoding/json" "flag" "fmt" - "io/ioutil" "log" "os" "os/user" @@ -89,7 +88,7 @@ func (cmd *adminCmd) parseArgs(as []string) { cmd.deleteTopic = args.deleteTopic if cmd.createTopic != "" { - buf, err := ioutil.ReadFile(args.topicDetailPath) + buf, err := os.ReadFile(args.topicDetailPath) if err != nil { failf("failed to read topic detail err=%v", err) } diff --git a/common.go b/common.go index 62f1198..550fabb 100644 --- a/common.go +++ b/common.go @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "math/rand" "os" "path/filepath" @@ -177,7 +176,7 @@ func setupCerts(certPath, caPath, keyPath string) (*tls.Config, error) { return nil, err } - caString, err := ioutil.ReadFile(caPath) + caString, err := os.ReadFile(caPath) if err != nil { return nil, err } @@ -242,7 +241,7 @@ func setupAuthTLS1Way(auth authConfig, saramaCfg *sarama.Config) error { return nil } - caString, err := ioutil.ReadFile(auth.CACert) + caString, err := os.ReadFile(auth.CACert) if err != nil { return fmt.Errorf("failed to read ca-certificate err=%v", err) } @@ -265,7 +264,7 @@ func setupAuthTLS(auth authConfig, saramaCfg *sarama.Config) error { return fmt.Errorf("client-certificate, client-certificate-key and ca-certificate are required - got auth=%#v", auth) } - caString, err := ioutil.ReadFile(auth.CACert) + caString, err := os.ReadFile(auth.CACert) if err != nil { return fmt.Errorf("failed to read ca-certificate err=%v", err) } @@ -306,7 +305,7 @@ func readAuthFile(argFN string, envFN string, target *authConfig) { fn = envFN } - byts, err := ioutil.ReadFile(fn) + byts, err := os.ReadFile(fn) if err != nil { failf("failed to read auth file err=%v", err) } diff --git a/system_test.go b/system_test.go index 9672c6a..b8aebfa 100644 --- a/system_test.go +++ b/system_test.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" "os" "os/exec" "sort" @@ -76,7 +75,7 @@ func TestSystem(t *testing.T) { buf, err := json.Marshal(topicDetail) require.NoError(t, err) fnTopicDetail := fmt.Sprintf("topic-detail-%v.json", randomString(6)) - err = ioutil.WriteFile(fnTopicDetail, buf, 0666) + err = os.WriteFile(fnTopicDetail, buf, 0666) require.NoError(t, err) defer os.RemoveAll(fnTopicDetail)