From a59173fae00cb0e1b683012054f9c070546605a1 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Mon, 28 Oct 2024 17:04:44 +0100 Subject: [PATCH] Refactor buffer initialization in NewReader. Replaced bytes.Buffer{} with bytes.NewBuffer(nil) for buffer initialization in NewReader method of Msg. This change enhances clarity and consistency in buffer handling. --- msg.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/msg.go b/msg.go index 4c42058..0b06a22 100644 --- a/msg.go +++ b/msg.go @@ -2371,8 +2371,8 @@ func (m *Msg) WriteToSendmailWithContext(ctx context.Context, sendmailPath strin // - https://datatracker.ietf.org/doc/html/rfc5322 func (m *Msg) NewReader() *Reader { reader := &Reader{} - buffer := bytes.Buffer{} - _, err := m.Write(&buffer) + buffer := bytes.NewBuffer(nil) + _, err := m.Write(buffer) if err != nil { reader.err = fmt.Errorf("failed to write Msg to Reader buffer: %w", err) }