From 279e298865e1c87fedee06e911e86dc753fea6d4 Mon Sep 17 00:00:00 2001 From: Femaref Date: Mon, 10 Sep 2018 11:51:15 +0200 Subject: [PATCH 1/2] make ErrTooManySPFRecords exported. The error is useful outside the library, and this way it's easier to be checked for. --- spf.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spf.go b/spf.go index 8c07aa6..b5b69fc 100644 --- a/spf.go +++ b/spf.go @@ -15,7 +15,7 @@ var ( ErrDNSLimitExceeded = errors.New("limit exceeded") ErrSPFNotFound = errors.New("SPF record not found") errInvalidCIDRLength = errors.New("invalid CIDR length") - errTooManySPFRecords = errors.New("too many SPF records") + ErrTooManySPFRecords = errors.New("too many SPF records") ) // IPMatcherFunc returns true if ip matches to implemented rules. @@ -202,7 +202,7 @@ func filterSPF(txt []string) (string, error) { n++ } if n > 1 { - return "", errTooManySPFRecords + return "", ErrTooManySPFRecords } return spf, nil } From 5ed53670e08a27de6b9ca51bda605281caca2370 Mon Sep 17 00:00:00 2001 From: Femaref Date: Mon, 10 Sep 2018 16:59:38 +0200 Subject: [PATCH 2/2] missed the reference in the tests --- parser_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser_test.go b/parser_test.go index baaa4ff..5729fe3 100644 --- a/parser_test.go +++ b/parser_test.go @@ -1210,7 +1210,7 @@ func TestSelectingRecord(t *testing.T) { {"v-spf2", None, ErrSPFNotFound}, {"v-spf10", None, ErrSPFNotFound}, {"no-record", None, ErrSPFNotFound}, - {"many-records", Permerror, errTooManySPFRecords}, + {"many-records", Permerror, ErrTooManySPFRecords}, {"mixed-records", Pass, nil}, }