Skip to content

fix: use zero-length slice with capacity for EmailTemplates#496

Merged
lakhansamani merged 3 commits intomainfrom
fix/email-templates-nil-slice
Mar 1, 2026
Merged

fix: use zero-length slice with capacity for EmailTemplates#496
lakhansamani merged 3 commits intomainfrom
fix/email-templates-nil-slice

Conversation

@lakhansamani
Copy link
Contributor

Summary

  • Changed make([]*model.EmailTemplate, len(emailTemplates)) to make([]*model.EmailTemplate, 0, len(emailTemplates))
  • Eliminates nil-padded entries in the API response

Test plan

  • Verify EmailTemplates query returns correct data without nil entries

Fixes #485

The slice was created with len(emailTemplates) nil elements, then
append added more entries after the nil padding. Changed to 0 length
with pre-allocated capacity.

Fixes #485
@lakhansamani lakhansamani merged commit e38d88d into main Mar 1, 2026
@lakhansamani lakhansamani deleted the fix/email-templates-nil-slice branch March 1, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EmailTemplates returns nil-padded slice

1 participant