Skip to content

fix(go): resolve memory leak, O(n^2) drain, and API improvements#13

Merged
indaco merged 3 commits intomainfrom
fix/go-review
Feb 19, 2026
Merged

fix(go): resolve memory leak, O(n^2) drain, and API improvements#13
indaco merged 3 commits intomainfrom
fix/go-review

Conversation

@indaco
Copy link
Copy Markdown
Owner

@indaco indaco commented Feb 19, 2026

Summary

  • Fix queue memory leak by zeroing front slot before reslicing
  • Replace O(n^2) GetMessagesAndDequeue with O(1) DrainAll
  • Remove fmt.Println from library code
  • Add nil queue guard, ErrEmptyQueue sentinel, and godoc
  • Return shallow copy from Builder.Build() to prevent shared state
  • Remove dead Icon type, fix error wrapping (%v -> %w)
  • Downgrade templ to v0.3.960 to fix dev proxy script escaping (Inline scripts break in v0.3.977 (&& → &&) a-h/templ#1316)

- Zero front slot in Dequeue to prevent memory leak
- Replace O(n²) GetMessagesAndDequeue with O(1) DrainAll
- Remove fmt.Println from library code
- Add nil queue guard with lazy init in Toaster.Queue()
- Add ErrEmptyQueue sentinel error
- Fix error wrapping: %v → %w in gohtml.go
- Fix incorrect godoc ("returns -1" → "returns zero-value Toast")
- Remove dead Icon type
- Return shallow copy from Builder.Build() to prevent shared state
- Fix test bug in options_test.go expected values
- Add missing tests for NewToast
- Add godoc to exported symbols
@indaco indaco merged commit c621c9c into main Feb 19, 2026
4 checks passed
@indaco indaco deleted the fix/go-review branch February 19, 2026 22:06
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.

1 participant