From 1a166770b73a169a7c90a2e91c0a07692f43711b Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Wed, 29 Nov 2023 16:42:07 +0100 Subject: [PATCH] Update range loop to improve msg function readability Converted the range loop in the GetAddrHeaderString function in msg.go to use value semantics rather than index notation. This improves code clarity by not unnecessarily referring to m.addrHeader[h] in the loop and instead referencing the value directly (using variable mh), making it easier to understand and maintain. --- msg.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/msg.go b/msg.go index 268349e..ab098f4 100644 --- a/msg.go +++ b/msg.go @@ -593,8 +593,8 @@ func (m *Msg) GetAddrHeader(h AddrHeader) []*mail.Address { // GetAddrHeaderString returns the address string of the requested address header of the Msg func (m *Msg) GetAddrHeaderString(h AddrHeader) []string { var al []string - for i := range m.addrHeader[h] { - al = append(al, m.addrHeader[h][i].String()) + for _, mh := range m.addrHeader[h] { + al = append(al, mh.String()) } return al }