mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-05 08:37:31 -04:00
all: remove ioutil usage from tests
This removes the remaining (and trivial) use of deprecated ioutil package from test files. Replacements are easy: ioutil.ReadAll -> io.ReadAll ioutil.ReadDir -> os.ReadDir ioutil.ReadFile -> os.ReadFile ioutil.WriteFile -> os.WriteFile While at it, simplify some error reporting. Change-Id: I60a242fd3c08d8fe571a18f16716439a9acdd59d Reviewed-on: https://go-review.googlesource.com/c/sys/+/526299 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
committed by
Gopher Robot
parent
fc717d344a
commit
fdc7ef4071
+5
-5
@@ -10,7 +10,7 @@ package unix_test
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
@@ -33,9 +33,9 @@ func TestDirent(t *testing.T) {
|
||||
|
||||
for i, c := range []byte("0123456789") {
|
||||
name := string(bytes.Repeat([]byte{c}, filenameMinSize+i))
|
||||
err := ioutil.WriteFile(filepath.Join(d, name), nil, 0644)
|
||||
err := os.WriteFile(filepath.Join(d, name), nil, 0644)
|
||||
if err != nil {
|
||||
t.Fatalf("writefile: %v", err)
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,9 +100,9 @@ func TestDirentRepeat(t *testing.T) {
|
||||
files = append(files, fmt.Sprintf("file%d", i))
|
||||
}
|
||||
for _, file := range files {
|
||||
err := ioutil.WriteFile(filepath.Join(d, file), []byte("contents"), 0644)
|
||||
err := os.WriteFile(filepath.Join(d, file), []byte("contents"), 0644)
|
||||
if err != nil {
|
||||
t.Fatalf("writefile: %v", err)
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user