Skip to content

Commit

Permalink
Remove deprecated ioutil package.
Browse files Browse the repository at this point in the history
  • Loading branch information
robdimsdale authored and ForestEckhardt committed May 11, 2022
1 parent dd5868f commit bf5a320
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package packit_test
import (
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -1379,7 +1378,7 @@ api = "0.5"

var exes []string
for i := 0; i < N; i++ {
command, err := ioutil.TempFile(cnbDir, "command")
command, err := os.CreateTemp(cnbDir, "command")
Expect(err).NotTo(HaveOccurred())

exes = append(exes, command.Name())
Expand Down
4 changes: 2 additions & 2 deletions sbom/internal/version/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package version

import (
"fmt"
"io/ioutil"
"io"
"net/http"
"strings"

Expand Down Expand Up @@ -60,7 +60,7 @@ func fetchLatestApplicationVersion() (*hashiVersion.Version, error) {
return nil, fmt.Errorf("HTTP %d on fetching latest version: %s", resp.StatusCode, resp.Status)
}

versionBytes, err := ioutil.ReadAll(resp.Body)
versionBytes, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("failed to read latest version: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions vacation/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"bytes"
"compress/gzip"
"encoding/base64"
"io"
"io/fs"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -363,7 +363,7 @@ func testArchive(t *testing.T, context spec.G, it spec.S) {
tempDir, err = os.MkdirTemp("", "vacation")
Expect(err).NotTo(HaveOccurred())

literalContents, err = ioutil.ReadAll(base64.NewDecoder(base64.StdEncoding, bytes.NewBuffer(encodedContents)))
literalContents, err = io.ReadAll(base64.NewDecoder(base64.StdEncoding, bytes.NewBuffer(encodedContents)))
Expect(err).NotTo(HaveOccurred())

archive = vacation.NewArchive(bytes.NewBuffer(literalContents))
Expand Down
4 changes: 2 additions & 2 deletions vacation/executable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package vacation_test
import (
"bytes"
"encoding/base64"
"io"
"io/fs"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -32,7 +32,7 @@ func testExecutable(t *testing.T, context spec.G, it spec.S) {
tempDir, err = os.MkdirTemp("", "vacation")
Expect(err).NotTo(HaveOccurred())

literalContents, err = ioutil.ReadAll(base64.NewDecoder(base64.StdEncoding, bytes.NewBuffer(encodedContents)))
literalContents, err = io.ReadAll(base64.NewDecoder(base64.StdEncoding, bytes.NewBuffer(encodedContents)))
Expect(err).NotTo(HaveOccurred())

archive = vacation.NewExecutable(bytes.NewBuffer(literalContents))
Expand Down

0 comments on commit bf5a320

Please sign in to comment.