net/mail: ParseAddress error message is confusing if given a partial addr-spec #27064
Labels
FrozenDueToAge
help wanted
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?go1.10.2 darwin/amd64
go1.10.3 linux/amd64
Does this issue reproduce with the latest release?
1.10 is the latest release
What operating system and processor architecture are you using (
go env
)?Primary platform is linux/amd64
What did you do?
net/mail
'smail.ParseAddress("some.bogus.email.address.with.no.at")
What did you expect to see?
"No @ in addr-spec"
Even better, an error message that doesn't require domain knowledge of RFC 5322 to be understood.
What did you see instead?
"mail: no angle-addr"
I believe the parser tries parsing an email address without angle-brackets first, and then tries to consume angle brackets. On the second pass, upon not finding angle brackets in the email address, it complains that the address isn't an angle-addr.
In any event, the validation error of:
some.bogus.email.address.with.no.at
should likely be that it lacks an@
symbol, not that it's not anangle-addr
.See: https://tools.ietf.org/html/rfc5322
I would prefer if error messages were either descriptive enough to be comprehensible by end users, or properly made into package globals so they could be trapped for without string matching, or both.
The text was updated successfully, but these errors were encountered: