From f37f89d5c74b74c4aecbc3e8970608927f75999a Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Wed, 12 Mar 2025 23:40:33 +0000 Subject: [PATCH] cleanup code --- app/app.go | 6 +++--- app/types.go | 2 +- app/utils.go | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/app.go b/app/app.go index bb8119a..8ca5cd1 100644 --- a/app/app.go +++ b/app/app.go @@ -127,7 +127,7 @@ func handle_GET_Instance(c *gin.Context) { func handle_GET_Login(c *gin.Context) { ctx := RequestContext{ Cookies: nil, - Body: map[string]interface{}{}, + Body: map[string]any{}, } res, err := RequestGetAPI("/proxmox/access/domains", ctx) if err != nil { @@ -144,8 +144,8 @@ func handle_GET_Login(c *gin.Context) { Name: "realm", } - for _, v := range ctx.Body["data"].([]interface{}) { - v = v.(map[string]interface{}) + for _, v := range ctx.Body["data"].([]any) { + v = v.(map[string]any) realm := Realm{} err := mapstructure.Decode(v, &realm) if err != nil { diff --git a/app/types.go b/app/types.go index 1a72cda..0a179e0 100644 --- a/app/types.go +++ b/app/types.go @@ -43,7 +43,7 @@ type RequestType int type RequestContext struct { Cookies map[string]string - Body map[string]interface{} + Body map[string]any } // used in constructing instance cards in index diff --git a/app/utils.go b/app/utils.go index 8b958d9..6c2fe79 100644 --- a/app/utils.go +++ b/app/utils.go @@ -169,7 +169,7 @@ func get_API_resources(token string, csrf string) (map[uint]Instance, map[string "PVEAuthCookie": token, "CSRFPreventionToken": csrf, }, - Body: map[string]interface{}{}, + Body: map[string]any{}, } res, err := RequestGetAPI("/proxmox/cluster/resources", ctx) if err != nil { @@ -180,8 +180,8 @@ func get_API_resources(token string, csrf string) (map[uint]Instance, map[string nodes := map[string]Node{} if res.StatusCode == 200 { // if we successfully retrieved the resources, then process it and return index - for _, v := range ctx.Body["data"].([]interface{}) { - m := v.(map[string]interface{}) + for _, v := range ctx.Body["data"].([]any) { + m := v.(map[string]any) if m["type"] == "node" { node := Node{} err := mapstructure.Decode(v, &node)