mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
refactor(hierarchy): use maps.Copy for attribute merge
Linter flagged the manual loop after recent edits surfaced the hint.
This commit is contained in:
1 parent
5697dfb0c0
commit
053ba93bc0
1 file changed
+2
-3
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user