mirror of
https://github.com/minio/minio.git
synced 2026-02-04 18:00:15 -05:00
tests: Do not allow forced type asserts (#20905)
This commit is contained in:
@@ -25,10 +25,10 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/minio/minio/internal/bpool"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
@@ -106,15 +106,15 @@ const blockSize = 8 << 10 // 8192
|
||||
|
||||
// By default at least 128 entries in single getdents call (1MiB buffer)
|
||||
var (
|
||||
direntPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
direntPool = bpool.Pool[*[]byte]{
|
||||
New: func() *[]byte {
|
||||
buf := make([]byte, blockSize*128)
|
||||
return &buf
|
||||
},
|
||||
}
|
||||
|
||||
direntNamePool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
direntNamePool = bpool.Pool[*[]byte]{
|
||||
New: func() *[]byte {
|
||||
buf := make([]byte, blockSize)
|
||||
return &buf
|
||||
},
|
||||
@@ -183,11 +183,10 @@ func readDirFn(dirPath string, fn func(name string, typ os.FileMode) error) erro
|
||||
}
|
||||
return osErrToFileErr(err)
|
||||
}
|
||||
|
||||
}
|
||||
defer syscall.Close(fd)
|
||||
|
||||
bufp := direntPool.Get().(*[]byte)
|
||||
bufp := direntPool.Get()
|
||||
defer direntPool.Put(bufp)
|
||||
buf := *bufp
|
||||
|
||||
@@ -273,11 +272,11 @@ func readDirWithOpts(dirPath string, opts readDirOpts) (entries []string, err er
|
||||
}
|
||||
defer syscall.Close(fd)
|
||||
|
||||
bufp := direntPool.Get().(*[]byte)
|
||||
bufp := direntPool.Get()
|
||||
defer direntPool.Put(bufp)
|
||||
buf := *bufp
|
||||
|
||||
nameTmp := direntNamePool.Get().(*[]byte)
|
||||
nameTmp := direntNamePool.Get()
|
||||
defer direntNamePool.Put(nameTmp)
|
||||
tmp := *nameTmp
|
||||
|
||||
|
||||
Reference in New Issue
Block a user