Chore: use any rather than interface{} (#74066)

This commit is contained in:
Ryan McKinley
2023-08-30 18:46:47 +03:00
committed by GitHub
parent 3e272d2bda
commit 025b2f3011
525 changed files with 2528 additions and 2528 deletions
+6 -6
View File
@@ -2,9 +2,9 @@ package maputil
import "fmt"
func GetMap(obj map[string]interface{}, key string) (map[string]interface{}, error) {
func GetMap(obj map[string]any, key string) (map[string]any, error) {
if untypedValue, ok := obj[key]; ok {
if value, ok := untypedValue.(map[string]interface{}); ok {
if value, ok := untypedValue.(map[string]any); ok {
return value, nil
} else {
err := fmt.Errorf("the field '%s' should be an object", key)
@@ -16,7 +16,7 @@ func GetMap(obj map[string]interface{}, key string) (map[string]interface{}, err
}
}
func GetBool(obj map[string]interface{}, key string) (bool, error) {
func GetBool(obj map[string]any, key string) (bool, error) {
if untypedValue, ok := obj[key]; ok {
if value, ok := untypedValue.(bool); ok {
return value, nil
@@ -30,7 +30,7 @@ func GetBool(obj map[string]interface{}, key string) (bool, error) {
}
}
func GetBoolOptional(obj map[string]interface{}, key string) (bool, error) {
func GetBoolOptional(obj map[string]any, key string) (bool, error) {
if untypedValue, ok := obj[key]; ok {
if value, ok := untypedValue.(bool); ok {
return value, nil
@@ -44,7 +44,7 @@ func GetBoolOptional(obj map[string]interface{}, key string) (bool, error) {
}
}
func GetString(obj map[string]interface{}, key string) (string, error) {
func GetString(obj map[string]any, key string) (string, error) {
if untypedValue, ok := obj[key]; ok {
if value, ok := untypedValue.(string); ok {
return value, nil
@@ -58,7 +58,7 @@ func GetString(obj map[string]interface{}, key string) (string, error) {
}
}
func GetStringOptional(obj map[string]interface{}, key string) (string, error) {
func GetStringOptional(obj map[string]any, key string) (string, error) {
if untypedValue, ok := obj[key]; ok {
if value, ok := untypedValue.(string); ok {
return value, nil