Skip to content

Commit

Permalink
Replace deprecated ioutil package
Browse files Browse the repository at this point in the history
`ioutil` has been deprecated in Go 1.16. The same functionality is now provided by package [io](https://pkg.go.dev/io) or package [os](https://pkg.go.dev/os).
  • Loading branch information
ksw2000 committed Apr 3, 2024
1 parent 87b8a9a commit cd6256a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions consopt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package tensor

import (
"fmt"
"io/ioutil"
"os"
"syscall"
"testing"
Expand Down Expand Up @@ -39,7 +38,7 @@ func Test_FromMemory(t *testing.T) {
t.Logf("%v", err)
}

f, err := ioutil.TempFile("", "test")
f, err := os.CreateTemp("", "test")

Check failure on line 41 in consopt_test.go

View workflow job for this annotation

GitHub Actions / test (1.15.x, ubuntu-latest, avx, false)

undefined: os.CreateTemp

Check failure on line 41 in consopt_test.go

View workflow job for this annotation

GitHub Actions / test (1.15.x, ubuntu-latest, sse, false)

undefined: os.CreateTemp

Check failure on line 41 in consopt_test.go

View workflow job for this annotation

GitHub Actions / coverage (avx)

undefined: os.CreateTemp

Check failure on line 41 in consopt_test.go

View workflow job for this annotation

GitHub Actions / coverage (sse)

undefined: os.CreateTemp
if err != nil {
t.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions dense_io_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tensor
import (
"bytes"
"encoding/gob"
"io/ioutil"
"io"
"os"
"os/exec"
"regexp"
Expand Down Expand Up @@ -75,7 +75,7 @@ func TestSaveLoadNumpy(t *testing.T) {
}

importError := `ImportError: No module named numpy`
slurpErr, _ := ioutil.ReadAll(stderr)
slurpErr, _ := io.ReadAll(stderr)

Check failure on line 78 in dense_io_test.go

View workflow job for this annotation

GitHub Actions / test (1.15.x, ubuntu-latest, avx, false)

undefined: io.ReadAll

Check failure on line 78 in dense_io_test.go

View workflow job for this annotation

GitHub Actions / test (1.15.x, ubuntu-latest, sse, false)

undefined: io.ReadAll

Check failure on line 78 in dense_io_test.go

View workflow job for this annotation

GitHub Actions / coverage (avx)

undefined: io.ReadAll

Check failure on line 78 in dense_io_test.go

View workflow job for this annotation

GitHub Actions / coverage (sse)

undefined: io.ReadAll
if ok, _ := regexp.Match(importError, slurpErr); ok {
t.Skipf("Skipping numpy test. It would appear that you do not have Numpy installed.")
}
Expand Down
3 changes: 1 addition & 2 deletions genlib2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"io"
"io/ioutil"
"log"
"os"
"os/exec"
Expand Down Expand Up @@ -182,7 +181,7 @@ func cleanup(loc string) error {
return err
}
for _, m := range matches {
b, err := ioutil.ReadFile(m)
b, err := os.ReadFile(m)

Check failure on line 184 in genlib2/main.go

View workflow job for this annotation

GitHub Actions / test (1.15.x, ubuntu-latest, avx, false)

undefined: os.ReadFile

Check failure on line 184 in genlib2/main.go

View workflow job for this annotation

GitHub Actions / test (1.15.x, ubuntu-latest, sse, false)

undefined: os.ReadFile

Check failure on line 184 in genlib2/main.go

View workflow job for this annotation

GitHub Actions / coverage (avx)

undefined: os.ReadFile

Check failure on line 184 in genlib2/main.go

View workflow job for this annotation

GitHub Actions / coverage (sse)

undefined: os.ReadFile
if err != nil {
return err
}
Expand Down

0 comments on commit cd6256a

Please sign in to comment.