Skip to content

Commit

Permalink
replace deprecated io/ioutil with os
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhuang12 committed Oct 26, 2021
1 parent f4f4f0a commit ac18007
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions controllers/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package controllers

import (
"encoding/json"
"io/ioutil"
"os"
"testing"

"github.com/google/go-containerregistry/pkg/name"
Expand All @@ -29,7 +29,7 @@ func TestExtractAuthn(t *testing.T) {
// the secret in testdata/secret.json was created with kubectl
// create secret docker-registry. Test that it can be decoded to
// get an authentication value.
b, err := ioutil.ReadFile("testdata/secret.json")
b, err := os.ReadFile("testdata/secret.json")
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -94,7 +94,7 @@ func TestExtractAuthForURLs(t *testing.T) {
}

for _, test := range testFiles {
b, err := ioutil.ReadFile("testdata/" + test.secretFile)
b, err := os.ReadFile("testdata/" + test.secretFile)
if err != nil {
t.Fatal(err)
}
Expand Down
3 changes: 1 addition & 2 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package controllers

import (
"context"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
Expand Down Expand Up @@ -95,7 +94,7 @@ var _ = BeforeSuite(func(done Done) {
})
Expect(err).ToNot(HaveOccurred())

badgerDir, err = ioutil.TempDir(os.TempDir(), "badger")
badgerDir, err = os.MkdirTemp(os.TempDir(), "badger")
Expect(err).ToNot(HaveOccurred())
badgerDB, err = badger.Open(badger.DefaultOptions(badgerDir))
Expect(err).ToNot(HaveOccurred())
Expand Down
3 changes: 1 addition & 2 deletions internal/database/badger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ limitations under the License.
package database

import (
"io/ioutil"
"os"
"reflect"
"testing"
Expand Down Expand Up @@ -82,7 +81,7 @@ func TestGetOnlyFetchesForRepo(t *testing.T) {

func createBadgerDatabase(t *testing.T) *BadgerDatabase {
t.Helper()
dir, err := ioutil.TempDir(os.TempDir(), "badger")
dir, err := os.MkdirTemp(os.TempDir(), "badger")
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit ac18007

Please sign in to comment.