Skip to content

Conversation

trtstm
Copy link
Contributor

@trtstm trtstm commented Jun 26, 2016

Fix for #3. But don't know if it's a good way to solve it...
The problem is that net.LookupTXT does not return a specific error if there was no TXT record. It just returns "no such host".

@maarten-postmastery
Copy link

Why not just return the underlying error?

record, err := spf.dns.GetSPFRecord(domain)
if err != nil {
    return nil, err
}

When err is nil, you should expect a valid SPF record. Policy about what to do when there is an SPF lookup error could be implemented on a higher level.

In any case, testing for error strings is bad practice. See this post and this post about inspecting errors.

@trtstm
Copy link
Contributor Author

trtstm commented Jun 28, 2016

Ye you are right, thats what I thought when reading #3. I just created this fix without considering whether this is something that should be fixed :). That's why I assigned @DenBeke to validate it.
So this pull request can be deleted if @DenBeke agrees with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants