mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
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:
@@ -30,7 +30,7 @@ import (
|
||||
|
||||
// ValidateFilterRuleValue - checks if given value is filter rule value or not.
|
||||
func ValidateFilterRuleValue(value string) error {
|
||||
for _, segment := range strings.Split(value, "/") {
|
||||
for segment := range strings.SplitSeq(value, "/") {
|
||||
if segment == "." || segment == ".." {
|
||||
return &ErrInvalidFilterValue{value}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ func (ruleList FilterRuleList) Pattern() string {
|
||||
|
||||
// S3Key - represents elements inside <S3Key>...</S3Key>
|
||||
type S3Key struct {
|
||||
RuleList FilterRuleList `xml:"S3Key,omitempty" json:"S3Key,omitempty"`
|
||||
RuleList FilterRuleList `xml:"S3Key,omitempty" json:"S3Key"`
|
||||
}
|
||||
|
||||
// MarshalXML implements a custom marshaller to support `omitempty` feature.
|
||||
|
||||
@@ -427,13 +427,13 @@ func (c *esClientV7) getServerSupportStatus(ctx context.Context) (ESSupportStatu
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
m := make(map[string]interface{})
|
||||
m := make(map[string]any)
|
||||
err = json.NewDecoder(resp.Body).Decode(&m)
|
||||
if err != nil {
|
||||
return ESSUnknown, "", fmt.Errorf("unable to get ES Server version - json parse error: %v", err)
|
||||
}
|
||||
|
||||
if v, ok := m["version"].(map[string]interface{}); ok {
|
||||
if v, ok := m["version"].(map[string]any); ok {
|
||||
if ver, ok := v["number"].(string); ok {
|
||||
status, err := getESVersionSupportStatus(ver)
|
||||
return status, ver, err
|
||||
@@ -454,16 +454,16 @@ func (c *esClientV7) createIndex(args ElasticsearchArgs) error {
|
||||
}
|
||||
defer res.Body.Close()
|
||||
|
||||
var v map[string]interface{}
|
||||
var v map[string]any
|
||||
found := false
|
||||
if err := json.NewDecoder(res.Body).Decode(&v); err != nil {
|
||||
return fmt.Errorf("Error parsing response body: %v", err)
|
||||
}
|
||||
|
||||
indices, ok := v["indices"].([]interface{})
|
||||
indices, ok := v["indices"].([]any)
|
||||
if ok {
|
||||
for _, index := range indices {
|
||||
if name, ok := index.(map[string]interface{}); ok && name["name"] == args.Index {
|
||||
if name, ok := index.(map[string]any); ok && name["name"] == args.Index {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
@@ -529,7 +529,7 @@ func (c *esClientV7) removeEntry(ctx context.Context, index string, key string)
|
||||
}
|
||||
|
||||
func (c *esClientV7) updateEntry(ctx context.Context, index string, key string, eventData event.Event) error {
|
||||
doc := map[string]interface{}{
|
||||
doc := map[string]any{
|
||||
"Records": []event.Event{eventData},
|
||||
}
|
||||
var buf bytes.Buffer
|
||||
@@ -556,7 +556,7 @@ func (c *esClientV7) updateEntry(ctx context.Context, index string, key string,
|
||||
}
|
||||
|
||||
func (c *esClientV7) addEntry(ctx context.Context, index string, eventData event.Event) error {
|
||||
doc := map[string]interface{}{
|
||||
doc := map[string]any{
|
||||
"Records": []event.Event{eventData},
|
||||
}
|
||||
var buf bytes.Buffer
|
||||
|
||||
@@ -19,6 +19,7 @@ package target
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"slices"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -26,11 +27,8 @@ import (
|
||||
// is registered and fails otherwise.
|
||||
func TestMySQLRegistration(t *testing.T) {
|
||||
var found bool
|
||||
for _, drv := range sql.Drivers() {
|
||||
if drv == "mysql" {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
if slices.Contains(sql.Drivers(), "mysql") {
|
||||
found = true
|
||||
}
|
||||
if !found {
|
||||
t.Fatal("mysql driver not registered")
|
||||
|
||||
@@ -19,6 +19,7 @@ package target
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"slices"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -26,11 +27,8 @@ import (
|
||||
// is registered and fails otherwise.
|
||||
func TestPostgreSQLRegistration(t *testing.T) {
|
||||
var found bool
|
||||
for _, drv := range sql.Drivers() {
|
||||
if drv == "postgres" {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
if slices.Contains(sql.Drivers(), "postgres") {
|
||||
found = true
|
||||
}
|
||||
if !found {
|
||||
t.Fatal("postgres driver not registered")
|
||||
|
||||
@@ -17,15 +17,15 @@
|
||||
|
||||
package event
|
||||
|
||||
import "maps"
|
||||
|
||||
// TargetIDSet - Set representation of TargetIDs.
|
||||
type TargetIDSet map[TargetID]struct{}
|
||||
|
||||
// Clone - returns copy of this set.
|
||||
func (set TargetIDSet) Clone() TargetIDSet {
|
||||
setCopy := NewTargetIDSet()
|
||||
for k, v := range set {
|
||||
setCopy[k] = v
|
||||
}
|
||||
maps.Copy(setCopy, set)
|
||||
return setCopy
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ package event
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"maps"
|
||||
"runtime"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
@@ -252,9 +253,7 @@ func (list *TargetList) TargetMap() map[TargetID]Target {
|
||||
defer list.RUnlock()
|
||||
|
||||
ntargets := make(map[TargetID]Target, len(list.targets))
|
||||
for k, v := range list.targets {
|
||||
ntargets[k] = v
|
||||
}
|
||||
maps.Copy(ntargets, list.targets)
|
||||
return ntargets
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user