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
+7 -7
View File
@@ -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
+3 -5
View File
@@ -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")
+3 -5
View File
@@ -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")