From f1aabaa99c31b49a68b2afc8d806d6717b71f232 Mon Sep 17 00:00:00 2001 From: Mariano Cano Date: Mon, 8 Aug 2022 12:12:53 -0700 Subject: [PATCH] Use functions from os instead of io/ioutil --- ca/identity/identity_test.go | 5 ++--- cas/stepcas/stepcas_test.go | 3 +-- templates/templates_test.go | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ca/identity/identity_test.go b/ca/identity/identity_test.go index 55fc60fd..eb32328a 100644 --- a/ca/identity/identity_test.go +++ b/ca/identity/identity_test.go @@ -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) } diff --git a/cas/stepcas/stepcas_test.go b/cas/stepcas/stepcas_test.go index 4654292d..8312589a 100644 --- a/cas/stepcas/stepcas_test.go +++ b/cas/stepcas/stepcas_test.go @@ -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) } diff --git a/templates/templates_test.go b/templates/templates_test.go index 2f169dac..0093d60f 100644 --- a/templates/templates_test.go +++ b/templates/templates_test.go @@ -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)