net.LookupTXT() returns a slice of strings, with one string for each TXT resource record returned. If there are multiple strings inside a TXT record it concatenates those before returning it.
dmarc.LookupWithOptions then concatenates all of those TXT resource records into a single string before parsing it.
If there are multiple TXT records for _dmarc.example.com it'll likely give the wrong response. That's not going to happen in
a healthy DNS zone, but it happens occasionally.
I think that correct behaviour would be for dmarc.LookupWithOptions to remove any TXT records that don't start with "v=", then return an error if there are more than one, then parse just the first remaining TXT RR, if any.
net.LookupTXT() returns a slice of strings, with one string for each TXT resource record returned. If there are multiple strings inside a TXT record it concatenates those before returning it.
dmarc.LookupWithOptions then concatenates all of those TXT resource records into a single string before parsing it.
If there are multiple TXT records for _dmarc.example.com it'll likely give the wrong response. That's not going to happen in a healthy DNS zone, but it happens occasionally.
I think that correct behaviour would be for dmarc.LookupWithOptions to remove any TXT records that don't start with "v=", then return an error if there are more than one, then parse just the first remaining TXT RR, if any.