From 74649294165b8665e26e7cdbda689d1db423e12f Mon Sep 17 00:00:00 2001 From: zhanluxianshen Date: Sat, 23 Mar 2024 00:32:47 +0000 Subject: [PATCH] Drop ioutil package. Signed-off-by: zhanluxianshen --- exec/executor_ssh.go | 7 ++++--- exec/nginx/nginx_test.go | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/exec/executor_ssh.go b/exec/executor_ssh.go index cd46e50..be54884 100644 --- a/exec/executor_ssh.go +++ b/exec/executor_ssh.go @@ -19,14 +19,15 @@ package exec import ( "context" "fmt" - "github.com/chaosblade-io/chaosblade-spec-go/log" - "io/ioutil" "net" + "os" "path" "strconv" "strings" "time" + "github.com/chaosblade-io/chaosblade-spec-go/log" + "github.com/chaosblade-io/chaosblade-exec-os/version" "github.com/chaosblade-io/chaosblade-spec-go/spec" @@ -284,7 +285,7 @@ func (c *SSHClient) connect() error { if c.Key == "" { auth = append(auth, ssh.Password(c.Password)) } else { - pemBytes, err := ioutil.ReadFile(c.Key) + pemBytes, err := os.ReadFile(c.Key) if err != nil { return err } diff --git a/exec/nginx/nginx_test.go b/exec/nginx/nginx_test.go index 4bbf99e..a18ead3 100644 --- a/exec/nginx/nginx_test.go +++ b/exec/nginx/nginx_test.go @@ -20,7 +20,7 @@ import ( "context" "errors" "fmt" - "io/ioutil" + "io" "net/http" "strings" "testing" @@ -89,7 +89,7 @@ func (tc *testCase) expectResponse(ctx context.Context, path, respBody string, r tc.t.Fatal(err.Error()) } defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) bodyString := strings.TrimSpace(string(body[:])) if err != nil { tc.t.Fatal(err.Error())