git » chasquid » commit 6641d85

courier: Extend TODO for DNS error handling on Go >= 1.13

author Alberto Bertogli
2020-03-12 21:46:21 UTC
committer Alberto Bertogli
2020-03-12 22:07:11 UTC
parent 150976b905e30d2db4eb1a56db2db0694f03108c

courier: Extend TODO for DNS error handling on Go >= 1.13

In https://github.com/albertito/chasquid/issues/4, ludusrusso comments
that the DNS lookup error handling in the SMTP courier could be improved
by using DNSError.IsNotFound.

That is true, but unfortunately it was only added in Go 1.13, and we are
currently trying to support Go 1.11 since that's what in Debian stable.

So this patch updates the TODO to note this, so that when we can use a
newer Go version, we improve this code.

internal/courier/smtp.go +1 -1

diff --git a/internal/courier/smtp.go b/internal/courier/smtp.go
index 7e16022..9f0cb74 100644
--- a/internal/courier/smtp.go
+++ b/internal/courier/smtp.go
@@ -260,7 +260,7 @@ func lookupMXs(tr *trace.Trace, domain string) ([]string, error) {
 		// Unfortunately, go's API doesn't let us easily distinguish between
 		// them. For now, if the error is permanent, we assume it's because
 		// there was no MX and fall back, otherwise we return.
-		// TODO: Find a better way to do this.
+		// TODO: Use dnsErr.IsNotFound once we can use Go >= 1.13.
 		dnsErr, ok := err.(*net.DNSError)
 		if !ok {
 			tr.Debugf("MX lookup error: %v", err)