diff options
-rw-r--r-- | components/components.go | 2 | ||||
-rw-r--r-- | gomponents.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/components/components.go b/components/components.go index 122882f..d37ccf4 100644 --- a/components/components.go +++ b/components/components.go @@ -44,7 +44,7 @@ type Classes map[string]bool // Render satisfies [g.Node]. func (c Classes) Render(w io.Writer) error { - var included []string + included := make([]string, 0, len(c)) for c, include := range c { if include { included = append(included, c) diff --git a/gomponents.go b/gomponents.go index 735ad00..ad9c2cd 100644 --- a/gomponents.go +++ b/gomponents.go @@ -250,7 +250,7 @@ func Rawf(format string, a ...interface{}) Node { // Map a slice of anything to a [Group] (which is just a slice of [Node]-s). func Map[T any](ts []T, cb func(T) Node) Group { - var nodes []Node + nodes := make([]Node, 0, len(ts)) for _, t := range ts { nodes = append(nodes, cb(t)) } |