io/ioutil has already been deprecated in golang 1.16, so replace all ioutil with io and os

This commit is contained in:
ahrtr
2021-10-30 06:41:02 +08:00
parent 2d0fa78f2f
commit fe95aa614c
96 changed files with 250 additions and 297 deletions

View File

@@ -20,7 +20,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"path/filepath"
"sync"
@@ -124,7 +124,7 @@ func (t *CassandraUpgradeTest) listUsers() ([]string, error) {
}
defer r.Body.Close()
if r.StatusCode != http.StatusOK {
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
if err != nil {
return nil, err
}
@@ -146,7 +146,7 @@ func (t *CassandraUpgradeTest) addUser(name string) error {
}
defer r.Body.Close()
if r.StatusCode != http.StatusOK {
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
if err != nil {
return err
}

View File

@@ -20,7 +20,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"path/filepath"
"sync"
@@ -118,7 +118,7 @@ func (t *EtcdUpgradeTest) listUsers() ([]string, error) {
}
defer r.Body.Close()
if r.StatusCode != http.StatusOK {
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
if err != nil {
return nil, err
}
@@ -139,7 +139,7 @@ func (t *EtcdUpgradeTest) addUser(name string) error {
}
defer r.Body.Close()
if r.StatusCode != http.StatusOK {
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
if err != nil {
return err
}

View File

@@ -20,7 +20,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"path/filepath"
"strconv"
@@ -187,7 +187,7 @@ func (t *MySQLUpgradeTest) addName(name string) error {
}
defer r.Body.Close()
if r.StatusCode != http.StatusOK {
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
if err != nil {
return err
}
@@ -205,7 +205,7 @@ func (t *MySQLUpgradeTest) countNames() (int, error) {
}
defer r.Body.Close()
if r.StatusCode != http.StatusOK {
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
if err != nil {
return 0, err
}