replace deprecated io/ioutil with os and io for cmd

This commit is contained in:
ahrtr
2021-11-02 08:54:28 +08:00
parent 6dd234d85c
commit 972dc46a1f
73 changed files with 187 additions and 239 deletions

View File

@@ -24,7 +24,7 @@ import (
"crypto/x509/pkix"
"encoding/json"
"encoding/pem"
"io/ioutil"
"io"
"math/big"
"net/http"
"net/http/httptest"
@@ -48,7 +48,7 @@ import (
// manager that will use the bootstrap client until we get a valid cert, then use our
// provided identity on subsequent requests.
func Test_buildClientCertificateManager(t *testing.T) {
testDir, err := ioutil.TempDir("", "kubeletcert")
testDir, err := os.MkdirTemp("", "kubeletcert")
if err != nil {
t.Fatal(err)
}
@@ -134,7 +134,7 @@ func Test_buildClientCertificateManager(t *testing.T) {
}
func Test_buildClientCertificateManager_populateCertDir(t *testing.T) {
testDir, err := ioutil.TempDir("", "kubeletcert")
testDir, err := os.MkdirTemp("", "kubeletcert")
if err != nil {
t.Fatal(err)
}
@@ -215,7 +215,7 @@ func getCSR(req *http.Request) (*certapi.CertificateSigningRequest, error) {
if req.Body == nil {
return nil, nil
}
body, err := ioutil.ReadAll(req.Body)
body, err := io.ReadAll(req.Body)
if err != nil {
return nil, err
}