Use functions from os instead of io/ioutil

This commit is contained in:
Mariano Cano 2022-08-08 12:12:53 -07:00
parent 8445c29db6
commit f1aabaa99c
3 changed files with 4 additions and 7 deletions

View file

@ -5,7 +5,6 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"net/http"
"os"
"path/filepath"
@ -188,7 +187,7 @@ func Test_fileExists(t *testing.T) {
}
func TestWriteDefaultIdentity(t *testing.T) {
tmpDir, err := ioutil.TempDir(os.TempDir(), "go-tests")
tmpDir, err := os.MkdirTemp(os.TempDir(), "go-tests")
if err != nil {
t.Fatal(err)
}
@ -373,7 +372,7 @@ func (r *renewer) Renew(tr http.RoundTripper) (*api.SignResponse, error) {
}
func TestIdentity_Renew(t *testing.T) {
tmpDir, err := ioutil.TempDir(os.TempDir(), "go-tests")
tmpDir, err := os.MkdirTemp(os.TempDir(), "go-tests")
if err != nil {
t.Fatal(err)
}

View file

@ -10,7 +10,6 @@ import (
"encoding/json"
"encoding/pem"
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
@ -291,7 +290,7 @@ func TestMain(m *testing.M) {
}
// Create test files.
path, err := ioutil.TempDir(os.TempDir(), "stepcas")
path, err := os.MkdirTemp(os.TempDir(), "stepcas")
if err != nil {
panic(err)
}

View file

@ -6,7 +6,6 @@ import (
"crypto/rand"
"encoding/base64"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"reflect"
@ -369,7 +368,7 @@ func TestTemplate_Output(t *testing.T) {
}
func TestOutput_Write(t *testing.T) {
dir, err := ioutil.TempDir("", "test-output-write")
dir, err := os.MkdirTemp("", "test-output-write")
assert.FatalError(t, err)
defer os.RemoveAll(dir)