minor code cleanup

This commit is contained in:
2026-06-15 16:13:42 +00:00
parent 2ef8837a03
commit 666fd92b30
3 changed files with 6 additions and 8 deletions
-1
View File
@@ -1,5 +1,4 @@
//go:build !release //go:build !release
// +build !release
package common package common
-1
View File
@@ -1,5 +1,4 @@
//go:build release //go:build release
// +build release
package common package common
+6 -6
View File
@@ -110,20 +110,20 @@ func LoadHTMLToGin(engine *gin.Engine, html map[string]StaticFile) *template.Tem
"MapKeys": func(x any, sep string) string { "MapKeys": func(x any, sep string) string {
v := reflect.ValueOf(x) v := reflect.ValueOf(x)
keys := v.MapKeys() keys := v.MapKeys()
s := "" var s strings.Builder
for i := 0; i < len(keys); i++ { for i := range keys {
if i != 0 { if i != 0 {
s += sep s.WriteString(sep)
} }
s += keys[i].String() s.WriteString(keys[i].String())
} }
return s return s.String()
}, },
"Map": func(values ...any) (map[string]any, error) { "Map": func(values ...any) (map[string]any, error) {
if len(values)%2 != 0 { if len(values)%2 != 0 {
return nil, errors.New("invalid dict call") return nil, errors.New("invalid dict call")
} }
dict := make(map[string]interface{}, len(values)/2) dict := make(map[string]any, len(values)/2)
for i := 0; i < len(values); i += 2 { for i := 0; i < len(values); i += 2 {
key, ok := values[i].(string) key, ok := values[i].(string)
if !ok { if !ok {