1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-09-16 08:36:30 +02:00

replace ioutil with io and os (#2327)

set the go version to 1.16 in pr.yml and tests.yml, so as to be consistent with the version in go.mod.
This commit is contained in:
Benjamin
2021-10-31 02:24:40 +08:00
committed by GitHub
parent ed690ed838
commit 5d5aee1f08
36 changed files with 84 additions and 95 deletions

View File

@@ -1,7 +1,7 @@
package http
import (
"io/ioutil"
"io"
"net"
"net/http"
"testing"
@@ -48,7 +48,7 @@ func TestRoundTripper(t *testing.T) {
t.Fatal(err)
}
b, err := ioutil.ReadAll(w.Body)
b, err := io.ReadAll(w.Body)
if err != nil {
t.Fatal(err)
}
@@ -68,7 +68,7 @@ func TestRoundTripper(t *testing.T) {
t.Fatal(err)
}
b, err = ioutil.ReadAll(rsp.Body)
b, err = io.ReadAll(rsp.Body)
if err != nil {
t.Fatal(err)
}

View File

@@ -4,7 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"io"
"net/http"
)
@@ -87,7 +87,7 @@ func newResponse(res *http.Response, err error) *Response {
return r
}
b, err := ioutil.ReadAll(r.res.Body)
b, err := io.ReadAll(r.res.Body)
if err == nil {
r.err = errors.New(string(b))
return r

View File

@@ -6,7 +6,6 @@ import (
"crypto/tls"
"errors"
"io"
"io/ioutil"
"net/http"
"os"
"path"
@@ -360,7 +359,7 @@ func NewClusterClient() *client {
logger.Fatal(errors.New("service account not found"))
}
token, err := ioutil.ReadFile(path.Join(serviceAccountPath, "token"))
token, err := os.ReadFile(path.Join(serviceAccountPath, "token"))
if err != nil {
logger.Fatal(err)
}

View File

@@ -6,7 +6,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"strings"
"text/template"
)
@@ -45,7 +45,7 @@ func certificatesFromFile(file string) ([]*x509.Certificate, error) {
if len(file) == 0 {
return nil, errors.New("error reading certificates from an empty filename")
}
pemBlock, err := ioutil.ReadFile(file)
pemBlock, err := os.ReadFile(file)
if err != nil {
return nil, err
}