diff --git a/internal/piwigo/piwigotools/categories.go b/internal/piwigo/piwigotools/categories.go index 4c0ea34..de50e38 100644 --- a/internal/piwigo/piwigotools/categories.go +++ b/internal/piwigo/piwigotools/categories.go @@ -10,9 +10,9 @@ type Category struct { } func (c *Categories) Names() []string { - names := []string{} - for _, category := range *c { - names = append(names, category.Name) + names := make([]string, len(*c)) + for i, category := range *c { + names[i] = category.Name } return names } diff --git a/internal/piwigo/piwigotools/tags.go b/internal/piwigo/piwigotools/tags.go index 59a3017..f3e1f32 100644 --- a/internal/piwigo/piwigotools/tags.go +++ b/internal/piwigo/piwigotools/tags.go @@ -17,13 +17,13 @@ type Tag struct { } func (c Tags) NamesWithAgeAt(createdAt TimeResult) []string { - names := []string{} - for _, category := range c { + names := make([]string, len(c)) + for i, category := range c { bd := category.Birthdate.AgeAt(createdAt) if bd != "" { - names = append(names, fmt.Sprintf("%s (%s)", category.Name, bd)) + names[i] = fmt.Sprintf("%s (%s)", category.Name, bd) } else { - names = append(names, category.Name) + names[i] = category.Name } } return names