diff --git a/cmd/kubectl-testkube/config/config_test.go b/cmd/kubectl-testkube/config/config_test.go index c75069dfebb..52988e3cdf2 100644 --- a/cmd/kubectl-testkube/config/config_test.go +++ b/cmd/kubectl-testkube/config/config_test.go @@ -1,7 +1,6 @@ package config import ( - "io/ioutil" "os" "testing" @@ -10,7 +9,7 @@ import ( func TestSave(t *testing.T) { // override default directory - dir, err := ioutil.TempDir("", "test-config-save") + dir, err := os.MkdirTemp("", "test-config-save") assert.NoError(t, err) defaultDirectory = dir diff --git a/contrib/executor/zap/pkg/runner/runner_test.go b/contrib/executor/zap/pkg/runner/runner_test.go index e99fc77ef95..3aeb02053fd 100644 --- a/contrib/executor/zap/pkg/runner/runner_test.go +++ b/contrib/executor/zap/pkg/runner/runner_test.go @@ -2,7 +2,6 @@ package runner import ( "context" - "io/ioutil" "os" "path/filepath" "testing" @@ -19,7 +18,7 @@ func TestRun(t *testing.T) { t.Run("Run successful API scan", func(t *testing.T) { // given - tempDir, err := ioutil.TempDir(os.TempDir(), "") + tempDir, err := os.MkdirTemp(os.TempDir(), "") assert.NoError(t, err) runner, err := NewRunner(context.TODO(), envs.Params{ DataDir: tempDir, @@ -50,7 +49,7 @@ func TestRun(t *testing.T) { t.Run("Run API scan with PASS and WARN", func(t *testing.T) { // given - tempDir, err := ioutil.TempDir(os.TempDir(), "") + tempDir, err := os.MkdirTemp(os.TempDir(), "") assert.NoError(t, err) runner, err := NewRunner(context.TODO(), envs.Params{ DataDir: tempDir, @@ -81,7 +80,7 @@ func TestRun(t *testing.T) { t.Run("Run API scan with WARN and FailOnWarn", func(t *testing.T) { // given - tempDir, err := ioutil.TempDir(os.TempDir(), "") + tempDir, err := os.MkdirTemp(os.TempDir(), "") assert.NoError(t, err) runner, err := NewRunner(context.TODO(), envs.Params{ DataDir: tempDir, @@ -112,7 +111,7 @@ func TestRun(t *testing.T) { t.Run("Run API scan with FAIL", func(t *testing.T) { // given - tempDir, err := ioutil.TempDir(os.TempDir(), "") + tempDir, err := os.MkdirTemp(os.TempDir(), "") assert.NoError(t, err) runner, err := NewRunner(context.TODO(), envs.Params{ DataDir: tempDir, @@ -143,7 +142,7 @@ func TestRun(t *testing.T) { t.Run("Run Baseline scan with PASS", func(t *testing.T) { // given - tempDir, err := ioutil.TempDir(os.TempDir(), "") + tempDir, err := os.MkdirTemp(os.TempDir(), "") assert.NoError(t, err) runner, err := NewRunner(context.TODO(), envs.Params{ DataDir: tempDir, @@ -172,7 +171,7 @@ func TestRun(t *testing.T) { t.Run("Run Baseline scan with WARN", func(t *testing.T) { // given - tempDir, err := ioutil.TempDir(os.TempDir(), "") + tempDir, err := os.MkdirTemp(os.TempDir(), "") assert.NoError(t, err) runner, err := NewRunner(context.TODO(), envs.Params{ DataDir: tempDir, @@ -202,7 +201,7 @@ func TestRun(t *testing.T) { t.Run("Run Full scan with FAIL", func(t *testing.T) { // given - tempDir, err := ioutil.TempDir(os.TempDir(), "") + tempDir, err := os.MkdirTemp(os.TempDir(), "") assert.NoError(t, err) runner, err := NewRunner(context.TODO(), envs.Params{ DataDir: tempDir, diff --git a/pkg/cloud/client/client_mock_test.go b/pkg/cloud/client/client_mock_test.go index 1a2b172a5db..2f6ec40b414 100644 --- a/pkg/cloud/client/client_mock_test.go +++ b/pkg/cloud/client/client_mock_test.go @@ -2,7 +2,7 @@ package client import ( "bytes" - "io/ioutil" + "io" "net/http" ) @@ -18,6 +18,6 @@ func (c ClientMock) Do(req *http.Request) (*http.Response, error) { return nil, err } return &http.Response{ - Body: ioutil.NopCloser(bytes.NewReader(c.body)), + Body: io.NopCloser(bytes.NewReader(c.body)), }, c.err } diff --git a/pkg/repository/storage/mongo.go b/pkg/repository/storage/mongo.go index 3c5ac512c55..94c754ad296 100644 --- a/pkg/repository/storage/mongo.go +++ b/pkg/repository/storage/mongo.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net/http" "os" "time" @@ -81,7 +80,7 @@ func getDocDBTLSConfig() (*tls.Config, error) { }() tlsConfig := new(tls.Config) - certs, err := ioutil.ReadFile(caFilePath) + certs, err := os.ReadFile(caFilePath) if err != nil { return nil, fmt.Errorf("could not read CA file: %s", err) }