1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-11-29 21:47:44 +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

@@ -3,7 +3,7 @@ package api
import (
"encoding/json"
"errors"
"io/ioutil"
"io"
"net/http"
log "go-micro.dev/v4/logger"
@@ -84,7 +84,7 @@ func newResponse(res *http.Response, err error) *Response {
log.Errorf("K8s: request failed with code %v", r.res.StatusCode)
b, err := ioutil.ReadAll(r.res.Body)
b, err := io.ReadAll(r.res.Body)
if err == nil {
log.Error("K8s: request failed with body:")
log.Error(string(b))

View File

@@ -3,7 +3,6 @@ package client
import (
"crypto/tls"
"errors"
"io/ioutil"
"net/http"
"os"
"path"
@@ -54,7 +53,7 @@ func detectNamespace() (string, error) {
}
// Read the file, and cast to a string
if ns, e := ioutil.ReadFile(nsPath); e != nil {
if ns, e := os.ReadFile(nsPath); e != nil {
return string(ns), e
} else {
return string(ns), nil
@@ -97,7 +96,7 @@ func NewClientInCluster() Kubernetes {
log.Fatal(errors.New("no k8s service account found"))
}
token, err := ioutil.ReadFile(path.Join(serviceAccountPath, "token"))
token, err := os.ReadFile(path.Join(serviceAccountPath, "token"))
if err != nil {
log.Fatal(err)
}

View File

@@ -5,7 +5,7 @@ import (
"encoding/pem"
"errors"
"fmt"
"io/ioutil"
"os"
)
// COPIED FROM
@@ -31,7 +31,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
}