refactor(hierarchy): use maps.Copy for attribute merge

Linter flagged the manual loop after recent edits surfaced the hint.
This commit is contained in:
pj committed 2026-04-27 00:06:50 +07:00
1 parent 5697dfb0c0
commit 053ba93bc0
1 file changed
+2 -3
+2 -3
View File
@@ -26,6 +26,7 @@ package hierarchy
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"maps"
"regexp" "regexp"
"strconv" "strconv"
"strings" "strings"
@@ -229,9 +230,7 @@ func elementFromNode(node *treeNodeJSON) *Element {
} }
element.Attributes = make(map[string]string, len(attrs)+5) element.Attributes = make(map[string]string, len(attrs)+5)
for k, v := range attrs { maps.Copy(element.Attributes, attrs)
element.Attributes[k] = v
}
if node.Clickable != nil { if node.Clickable != nil {
element.Attributes["clickable"] = strconv.FormatBool(*node.Clickable) element.Attributes["clickable"] = strconv.FormatBool(*node.Clickable)
} }