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.
This commit is contained in:
Winni Neessen 2023-11-29 16:42:07 +01:00
parent bb18ef9e93
commit 1a166770b7
Signed by: wneessen
GPG key ID: 5F3AF39B820C119D

4
msg.go
View file

@ -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
}