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

@@ -254,7 +254,7 @@ func HashString(input string) string {
// LogAlwaysIf prints a detailed error message during
// the execution of the server.
func LogAlwaysIf(ctx context.Context, subsystem string, err error, errKind ...interface{}) {
func LogAlwaysIf(ctx context.Context, subsystem string, err error, errKind ...any) {
if err == nil {
return
}
@@ -264,7 +264,7 @@ func LogAlwaysIf(ctx context.Context, subsystem string, err error, errKind ...in
// LogIf prints a detailed error message during
// the execution of the server, if it is not an
// ignored error.
func LogIf(ctx context.Context, subsystem string, err error, errKind ...interface{}) {
func LogIf(ctx context.Context, subsystem string, err error, errKind ...any) {
if logIgnoreError(err) {
return
}
@@ -285,7 +285,7 @@ func LogIfNot(ctx context.Context, subsystem string, err error, ignored ...error
logIf(ctx, subsystem, err)
}
func errToEntry(ctx context.Context, subsystem string, err error, errKind ...interface{}) log.Entry {
func errToEntry(ctx context.Context, subsystem string, err error, errKind ...any) log.Entry {
var l string
if anonFlag {
l = reflect.TypeOf(err).String()
@@ -295,11 +295,11 @@ func errToEntry(ctx context.Context, subsystem string, err error, errKind ...int
return buildLogEntry(ctx, subsystem, l, getTrace(3), errKind...)
}
func logToEntry(ctx context.Context, subsystem, message string, errKind ...interface{}) log.Entry {
func logToEntry(ctx context.Context, subsystem, message string, errKind ...any) log.Entry {
return buildLogEntry(ctx, subsystem, message, nil, errKind...)
}
func buildLogEntry(ctx context.Context, subsystem, message string, trace []string, errKind ...interface{}) log.Entry {
func buildLogEntry(ctx context.Context, subsystem, message string, trace []string, errKind ...any) log.Entry {
logKind := madmin.LogKindError
if len(errKind) > 0 {
if ek, ok := errKind[0].(madmin.LogKind); ok {
@@ -326,7 +326,7 @@ func buildLogEntry(ctx context.Context, subsystem, message string, trace []strin
}
// Copy tags. We hold read lock already.
tags := make(map[string]interface{}, len(req.tags))
tags := make(map[string]any, len(req.tags))
for _, entry := range req.tags {
tags[entry.Key] = entry.Val
}
@@ -379,7 +379,7 @@ func buildLogEntry(ctx context.Context, subsystem, message string, trace []strin
entry.API.Args.Object = HashString(entry.API.Args.Object)
entry.RemoteHost = HashString(entry.RemoteHost)
if entry.Trace != nil {
entry.Trace.Variables = make(map[string]interface{})
entry.Trace.Variables = make(map[string]any)
}
}
@@ -388,7 +388,7 @@ func buildLogEntry(ctx context.Context, subsystem, message string, trace []strin
// consoleLogIf prints a detailed error message during
// the execution of the server.
func consoleLogIf(ctx context.Context, subsystem string, err error, errKind ...interface{}) {
func consoleLogIf(ctx context.Context, subsystem string, err error, errKind ...any) {
if DisableLog {
return
}
@@ -403,7 +403,7 @@ func consoleLogIf(ctx context.Context, subsystem string, err error, errKind ...i
// logIf prints a detailed error message during
// the execution of the server.
func logIf(ctx context.Context, subsystem string, err error, errKind ...interface{}) {
func logIf(ctx context.Context, subsystem string, err error, errKind ...any) {
if DisableLog {
return
}
@@ -431,7 +431,7 @@ func sendLog(ctx context.Context, entry log.Entry) {
}
// Event sends a event log to log targets
func Event(ctx context.Context, subsystem, msg string, args ...interface{}) {
func Event(ctx context.Context, subsystem, msg string, args ...any) {
if DisableLog {
return
}
@@ -444,7 +444,7 @@ var ErrCritical struct{}
// CriticalIf logs the provided error on the console. It fails the
// current go-routine by causing a `panic(ErrCritical)`.
func CriticalIf(ctx context.Context, err error, errKind ...interface{}) {
func CriticalIf(ctx context.Context, err error, errKind ...any) {
if err != nil {
LogIf(ctx, "", err, errKind...)
panic(ErrCritical)
@@ -452,7 +452,7 @@ func CriticalIf(ctx context.Context, err error, errKind ...interface{}) {
}
// FatalIf is similar to Fatal() but it ignores passed nil error
func FatalIf(err error, msg string, data ...interface{}) {
func FatalIf(err error, msg string, data ...any) {
if err == nil {
return
}