tests: Do not allow forced type asserts (#20905)

This commit is contained in:
Klaus Post
2025-02-18 08:25:55 -08:00
committed by GitHub
parent aeabac9181
commit 90f5e1e5f6
100 changed files with 371 additions and 358 deletions

View File

@@ -102,7 +102,7 @@ func TestCloseOnWriter(t *testing.T) {
// Test for AppendFile.
func TestAppendFile(t *testing.T) {
f, err := os.CreateTemp("", "")
f, err := os.CreateTemp(t.TempDir(), "")
if err != nil {
t.Fatal(err)
}
@@ -111,7 +111,7 @@ func TestAppendFile(t *testing.T) {
f.WriteString("aaaaaaaaaa")
f.Close()
f, err = os.CreateTemp("", "")
f, err = os.CreateTemp(t.TempDir(), "")
if err != nil {
t.Fatal(err)
}
@@ -162,7 +162,7 @@ func TestSkipReader(t *testing.T) {
}
func TestSameFile(t *testing.T) {
f, err := os.CreateTemp("", "")
f, err := os.CreateTemp(t.TempDir(), "")
if err != nil {
t.Errorf("Error creating tmp file: %v", err)
}
@@ -193,7 +193,7 @@ func TestSameFile(t *testing.T) {
}
func TestCopyAligned(t *testing.T) {
f, err := os.CreateTemp("", "")
f, err := os.CreateTemp(t.TempDir(), "")
if err != nil {
t.Errorf("Error creating tmp file: %v", err)
}
@@ -202,7 +202,7 @@ func TestCopyAligned(t *testing.T) {
r := strings.NewReader("hello world")
bufp := ODirectPoolSmall.Get().(*[]byte)
bufp := ODirectPoolSmall.Get()
defer ODirectPoolSmall.Put(bufp)
written, err := CopyAligned(f, io.LimitReader(r, 5), *bufp, r.Size(), f)