Skip to content

Commit

Permalink
Merge pull request #145 from testwill/ioutil
Browse files Browse the repository at this point in the history
chore: remove refs to deprecated io/ioutil
  • Loading branch information
fgeller authored Oct 26, 2023
2 parents 12726dc + 232a933 commit e062ed5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
3 changes: 1 addition & 2 deletions admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"os/user"
Expand Down Expand Up @@ -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)
}
Expand Down
9 changes: 4 additions & 5 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down
3 changes: 1 addition & 2 deletions system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"os/exec"
"sort"
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit e062ed5

Please sign in to comment.