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
+7 -7
View File
@@ -28,11 +28,11 @@ import (
"net/http"
"strconv"
"strings"
"sync"
"time"
"github.com/gobwas/ws"
"github.com/gobwas/ws/wsutil"
"github.com/minio/minio/internal/bpool"
)
// ErrDisconnected is returned when the connection to the remote has been lost during the call.
@@ -68,15 +68,15 @@ const (
defaultSingleRequestTimeout = time.Minute
)
var internalByteBuffer = sync.Pool{
New: func() any {
var internalByteBuffer = bpool.Pool[*[]byte]{
New: func() *[]byte {
m := make([]byte, 0, defaultBufferSize)
return &m
},
}
var internal32KByteBuffer = sync.Pool{
New: func() any {
var internal32KByteBuffer = bpool.Pool[*[]byte]{
New: func() *[]byte {
m := make([]byte, 0, biggerBufMin)
return &m
},
@@ -87,7 +87,7 @@ var internal32KByteBuffer = sync.Pool{
// When replacing PutByteBuffer should also be replaced
// There is no minimum size.
var GetByteBuffer = func() []byte {
b := *internalByteBuffer.Get().(*[]byte)
b := *internalByteBuffer.Get()
return b[:0]
}
@@ -101,7 +101,7 @@ func GetByteBufferCap(wantSz int) []byte {
PutByteBuffer(b)
}
if wantSz <= maxBufferSize {
b := *internal32KByteBuffer.Get().(*[]byte)
b := *internal32KByteBuffer.Get()
if cap(b) >= wantSz {
return b[:0]
}