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
@@ -27,17 +27,17 @@ func main() {
log.Fatal(err)
}
data := make(map[string]interface{})
data := make(map[string]any)
if err := json.Unmarshal(b, &data); err != nil {
log.Fatal(err)
}
info, ok := data["info"].(map[string]interface{})
info, ok := data["info"].(map[string]any)
if info == nil {
log.Fatal("expecting 'info' field")
}
if !ok {
log.Fatal("unable to turn info field into map[string]interface{}")
log.Fatal("unable to turn info field into map[string]any")
}
if info["title"] == nil {
@@ -49,9 +49,9 @@ func main() {
log.Fatal("no definitions")
}
defs := definitions.(map[string]interface{})
defs := definitions.(map[string]any)
for k, v := range defs {
vMap := v.(map[string]interface{})
vMap := v.(map[string]any)
refKey, ok := vMap[RefKey]
if !ok {
continue
@@ -63,24 +63,24 @@ func main() {
}
}
paths, ok := data["paths"].(map[string]interface{})
paths, ok := data["paths"].(map[string]any)
if !ok {
log.Fatal("no paths")
}
for _, path := range paths {
path, ok := path.(map[string]interface{})
path, ok := path.(map[string]any)
if !ok {
log.Fatal("invalid path")
}
for _, op := range path {
op, ok := op.(map[string]interface{})
op, ok := op.(map[string]any)
if !ok {
continue
}
tags, ok := op["tags"].([]interface{})
tags, ok := op["tags"].([]any)
if !ok {
log.Println("invalid op, skipping")
continue