Skip to content

Commit

Permalink
interface{} replaced with any
Browse files Browse the repository at this point in the history
  • Loading branch information
sinadarbouy committed Jul 28, 2024
1 parent c72f59f commit d309592
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}
Expand Down Expand Up @@ -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"])
Expand Down
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion plugin/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d309592

Please sign in to comment.