From d30959217377ae5a31177f9f2236524a516bbf1f Mon Sep 17 00:00:00 2001 From: sinadarbouy Date: Sun, 28 Jul 2024 21:26:12 +0200 Subject: [PATCH] interface{} replaced with any --- api/api_test.go | 8 ++++---- config/config.go | 4 ++-- plugin/utils.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/api_test.go b/api/api_test.go index 799d3f3a..a6717ab8 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -221,8 +221,8 @@ func TestPools(t *testing.T) { assert.NotEmpty(t, pools.AsMap()) assert.Equal(t, - map[string]interface{}{ - config.DefaultConfigurationBlock: map[string]interface{}{"cap": 0.0, "size": 0.0}, + map[string]any{ + config.DefaultConfigurationBlock: map[string]any{"cap": 0.0, "size": 0.0}, }, pools.AsMap()[config.Default]) } @@ -273,8 +273,8 @@ func TestGetProxies(t *testing.T) { assert.NotEmpty(t, proxies) assert.NotEmpty(t, proxies.AsMap()) - if defaultProxies, ok := proxies.AsMap()[config.Default].(map[string]interface{}); ok { - if defaultProxy, ok := defaultProxies[config.DefaultConfigurationBlock].(map[string]interface{}); ok { + if defaultProxies, ok := proxies.AsMap()[config.Default].(map[string]any); ok { + if defaultProxy, ok := defaultProxies[config.DefaultConfigurationBlock].(map[string]any); ok { assert.Equal(t, 1.0, defaultProxy["total"]) assert.NotEmpty(t, defaultProxy["available"]) assert.Empty(t, defaultProxy["busy"]) diff --git a/config/config.go b/config/config.go index a70f578e..7401cc69 100644 --- a/config/config.go +++ b/config/config.go @@ -189,7 +189,7 @@ func (c *Config) LoadDefaults(ctx context.Context) *gerr.GatewayDError { } for configObject, configMap := range gconf { - configGroup, ok := configMap.(map[string]interface{}) + configGroup, ok := configMap.(map[string]any) if !ok { err := fmt.Errorf("invalid config structure for %s", configObject) span.RecordError(err) @@ -208,7 +208,7 @@ func (c *Config) LoadDefaults(ctx context.Context) *gerr.GatewayDError { continue } - configBlocks, ok := configBlocksInterface.(map[string]interface{}) + configBlocks, ok := configBlocksInterface.(map[string]any) if !ok { err := fmt.Errorf("invalid config blocks structure for %s.%s", configObject, configGroupKey) span.RecordError(err) diff --git a/plugin/utils.go b/plugin/utils.go index 39ba522e..bb4bc87d 100644 --- a/plugin/utils.go +++ b/plugin/utils.go @@ -42,7 +42,7 @@ func castToPrimitiveTypes(args map[string]interface{}) map[string]interface{} { } } args[key] = array - case map[string]map[string]interface{}: + case map[string]map[string]any: for _, valuemap := range value { // Recursively cast nested maps. args[key] = castToPrimitiveTypes(valuemap)