From 6268077b99f6d6421d1c6c7fa4ad479d13d289bf Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Thu, 30 Nov 2023 09:14:31 +0100 Subject: [PATCH] Make golangci-lint happy Omitting nil redundant nil checks, as len() for []string is defined as zero --- msg_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/msg_test.go b/msg_test.go index 8bf0de6..47d5b18 100644 --- a/msg_test.go +++ b/msg_test.go @@ -1135,7 +1135,7 @@ func TestMsg_RequestMDN(t *testing.T) { if err := m.RequestMDNTo(v); err != nil { t.Errorf("RequestMDNTo with a single valid address failed: %s", err) } - if val := m.genHeader[HeaderDispositionNotificationTo]; val != nil && len(val) > 1 { + if val := m.genHeader[HeaderDispositionNotificationTo]; len(val) > 1 { if val[0] != fmt.Sprintf("<%s>", v) { t.Errorf("RequestMDNTo with a single valid address failed. Expected: %s, got: %s", v, val[0]) @@ -1147,13 +1147,13 @@ func TestMsg_RequestMDN(t *testing.T) { if err := m.RequestMDNTo(vl...); err != nil { t.Errorf("RequestMDNTo with a multiple valid address failed: %s", err) } - if val := m.genHeader[HeaderDispositionNotificationTo]; val != nil && len(val) > 0 { + if val := m.genHeader[HeaderDispositionNotificationTo]; len(val) > 0 { if val[0] != fmt.Sprintf("<%s>", v) { t.Errorf("RequestMDNTo with a multiple valid addresses failed. Expected 0: %s, got 0: %s", v, val[0]) } } - if val := m.genHeader[HeaderDispositionNotificationTo]; val != nil && len(val) > 1 { + if val := m.genHeader[HeaderDispositionNotificationTo]; len(val) > 1 { if val[1] != fmt.Sprintf("<%s>", v2) { t.Errorf("RequestMDNTo with a multiple valid addresses failed. Expected 1: %s, got 1: %s", v2, val[1]) @@ -1174,7 +1174,7 @@ func TestMsg_RequestMDN(t *testing.T) { if err := m.RequestMDNAddTo(v2); err != nil { t.Errorf("RequestMDNAddTo with a valid address failed: %s", err) } - if val := m.genHeader[HeaderDispositionNotificationTo]; val != nil && len(val) > 1 { + if val := m.genHeader[HeaderDispositionNotificationTo]; len(val) > 1 { if val[1] != fmt.Sprintf("<%s>", v2) { t.Errorf("RequestMDNTo with a multiple valid addresses failed. Expected 1: %s, got 1: %s", v2, val[1]) @@ -1186,7 +1186,7 @@ func TestMsg_RequestMDN(t *testing.T) { if err := m.RequestMDNToFormat(n, v); err != nil { t.Errorf("RequestMDNToFormat with a single valid address failed: %s", err) } - if val := m.genHeader[HeaderDispositionNotificationTo]; val != nil && len(val) > 0 { + if val := m.genHeader[HeaderDispositionNotificationTo]; len(val) > 0 { if val[0] != fmt.Sprintf(`"%s" <%s>`, n, v) { t.Errorf(`RequestMDNToFormat with a single valid address failed. Expected: "%s" <%s>, got: %s`, n, v, val[0]) @@ -1195,7 +1195,7 @@ func TestMsg_RequestMDN(t *testing.T) { if err := m.RequestMDNAddToFormat(n2, v2); err != nil { t.Errorf("RequestMDNAddToFormat with a valid address failed: %s", err) } - if val := m.genHeader[HeaderDispositionNotificationTo]; val != nil && len(val) > 1 { + if val := m.genHeader[HeaderDispositionNotificationTo]; len(val) > 1 { if val[1] != fmt.Sprintf(`"%s" <%s>`, n2, v2) { t.Errorf(`RequestMDNAddToFormat with a single valid address failed. Expected: "%s" <%s>, got: %s`, n2, v2, val[1])