Skip to content

Commit

Permalink
chore: remove refs to deprecated io/ioutil (#1038)
Browse files Browse the repository at this point in the history
Signed-off-by: guoguangwu <[email protected]>
  • Loading branch information
testwill committed Jul 10, 2023
1 parent 7a35ef8 commit b9aa782
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
5 changes: 2 additions & 3 deletions pkg/cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package cluster

import (
"fmt"
"io/ioutil"
"math/rand"
"os"
"path"
Expand Down Expand Up @@ -568,7 +567,7 @@ func TestUtilEqual(t *testing.T) {
}

func TestIsLeader(t *testing.T) {
etcdDirName, err := ioutil.TempDir("", "cluster-test")
etcdDirName, err := os.MkdirTemp("", "cluster-test")
check(err)
defer os.RemoveAll(etcdDirName)

Expand All @@ -592,7 +591,7 @@ func TestInvalidConfig(t *testing.T) {

func TestRunDefrag(t *testing.T) {
assert := assert.New(t)
etcdDirName, err := ioutil.TempDir("", "cluster-test")
etcdDirName, err := os.MkdirTemp("", "cluster-test")
check(err)
defer os.RemoveAll(etcdDirName)

Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/kafkabackend/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package kafka

import (
"fmt"
"io/ioutil"
"io"
"net/http"

"github.com/Shopify/sarama"
Expand Down Expand Up @@ -156,7 +156,7 @@ func (k *Kafka) Handle(ctx *context.Context) (result string) {
req := ctx.GetInputRequest().(*httpprot.Request)
topic := k.getTopic(req)

body, err := ioutil.ReadAll(req.GetPayload())
body, err := io.ReadAll(req.GetPayload())
if err != nil {
return resultParseErr
}
Expand Down
9 changes: 4 additions & 5 deletions pkg/object/autocertmanager/autocertmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
"fmt"
"html/template"
"io"
"io/ioutil"
"math/big"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -543,7 +542,7 @@ domains:
name: customDNS
zone: megaease.com
directoryURL: ` + url
etcdDirName, err := ioutil.TempDir("", "autocertmanager-test")
etcdDirName, err := os.MkdirTemp("", "autocertmanager-test")
if err != nil {
t.Errorf(err.Error())
}
Expand Down Expand Up @@ -677,7 +676,7 @@ domains:
name: customDNS
zone: megaease.com
directoryURL: ` + url
etcdDirName, err := ioutil.TempDir("", "autocertmanager-test")
etcdDirName, err := os.MkdirTemp("", "autocertmanager-test")
if err != nil {
t.Errorf(err.Error())
}
Expand Down Expand Up @@ -725,7 +724,7 @@ domains:
name: customDNS
zone: megaease.com
directoryURL: ` + url
etcdDirName, err := ioutil.TempDir("", "autocertmanager-test")
etcdDirName, err := os.MkdirTemp("", "autocertmanager-test")
if err != nil {
t.Errorf(err.Error())
}
Expand Down Expand Up @@ -835,7 +834,7 @@ func waitDNSRecordTest(t *testing.T, d Domain) {
}

func TestDomain(t *testing.T) {
etcdDirName, err := ioutil.TempDir("", "autocertmanager-domain-test")
etcdDirName, err := os.MkdirTemp("", "autocertmanager-domain-test")
if err != nil {
t.Errorf(err.Error())
}
Expand Down

0 comments on commit b9aa782

Please sign in to comment.