Run modernize (#21546)

`go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./...` executed.

`go generate ./...` ran afterwards to keep generated.
This commit is contained in:
Klaus Post
2025-08-29 04:39:48 +02:00
committed by GitHub
parent 3b7cb6512c
commit f0b91e5504
238 changed files with 913 additions and 1257 deletions

View File

@@ -156,7 +156,6 @@ func testListObjectsVersionedFolders(obj ObjectLayer, instanceType string, t1 Te
}
for i, testCase := range testCases {
testCase := testCase
t.Run(fmt.Sprintf("%s-Test%d", instanceType, i+1), func(t *testing.T) {
var err error
var resultL ListObjectsInfo
@@ -944,7 +943,6 @@ func _testListObjects(obj ObjectLayer, instanceType string, t1 TestErrHandler, v
}
for i, testCase := range testCases {
testCase := testCase
t.Run(fmt.Sprintf("%s-Test%d", instanceType, i+1), func(t *testing.T) {
t.Log("ListObjects, bucket:", testCase.bucketName, "prefix:", testCase.prefix, "marker:", testCase.marker, "delimiter:", testCase.delimiter, "maxkeys:", testCase.maxKeys)
result, err := obj.ListObjects(t.Context(), testCase.bucketName,
@@ -1676,7 +1674,6 @@ func testListObjectVersions(obj ObjectLayer, instanceType string, t1 TestErrHand
}
for i, testCase := range testCases {
testCase := testCase
t.Run(fmt.Sprintf("%s-Test%d", instanceType, i+1), func(t *testing.T) {
result, err := obj.ListObjectVersions(t.Context(), testCase.bucketName,
testCase.prefix, testCase.marker, "", testCase.delimiter, int(testCase.maxKeys))
@@ -1827,7 +1824,6 @@ func testListObjectsContinuation(obj ObjectLayer, instanceType string, t1 TestEr
}
for i, testCase := range testCases {
testCase := testCase
t.Run(fmt.Sprintf("%s-Test%d", instanceType, i+1), func(t *testing.T) {
var foundObjects []ObjectInfo
var foundPrefixes []string
@@ -1914,7 +1910,7 @@ func BenchmarkListObjects(b *testing.B) {
}
// Insert objects to be listed and benchmarked later.
for i := 0; i < 20000; i++ {
for i := range 20000 {
key := "obj" + strconv.Itoa(i)
_, err = obj.PutObject(b.Context(), bucket, key, mustGetPutObjReader(b, bytes.NewBufferString(key), int64(len(key)), "", ""), ObjectOptions{})
if err != nil {
@@ -1922,10 +1918,8 @@ func BenchmarkListObjects(b *testing.B) {
}
}
b.ResetTimer()
// List the buckets over and over and over.
for i := 0; i < b.N; i++ {
for b.Loop() {
_, err = obj.ListObjects(b.Context(), bucket, "", "obj9000", "", -1)
if err != nil {
b.Fatal(err)