mirror of
https://blitiri.com.ar/repos/chasquid
synced 2026-01-05 17:37:03 +00:00
Minor style and simplification cleanups
This patch does various minor style and simplification cleanups, fixing things detected by tools such as go vet, gofmt -s, and golint. There are no functional changes, this change is purely cosmetic, but will enable us to run those tools more regularly now that their output is clean.
This commit is contained in:
@@ -25,7 +25,7 @@ var (
|
||||
)
|
||||
|
||||
var (
|
||||
timeoutError = fmt.Errorf("Operation timed out")
|
||||
errTimeout = fmt.Errorf("Operation timed out")
|
||||
)
|
||||
|
||||
// Procmail delivers local mail via procmail.
|
||||
@@ -79,7 +79,7 @@ func (p *Procmail) Deliver(from string, to string, data []byte) error {
|
||||
timedOut := !timer.Stop()
|
||||
|
||||
if timedOut {
|
||||
return tr.Error(timeoutError)
|
||||
return tr.Error(errTimeout)
|
||||
}
|
||||
if err != nil {
|
||||
return tr.Errorf("Procmail failed: %v - %q", err, output.String())
|
||||
|
||||
@@ -39,7 +39,7 @@ func TestProcmailTimeout(t *testing.T) {
|
||||
p := Procmail{}
|
||||
|
||||
err := p.Deliver("from", "to@local", []byte("data"))
|
||||
if err != timeoutError {
|
||||
if err != errTimeout {
|
||||
t.Errorf("Unexpected error: %v", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -86,19 +86,19 @@ func TestSMTPErrors(t *testing.T) {
|
||||
|
||||
responses := []map[string]string{
|
||||
// First test: hang response, should fail due to timeout.
|
||||
map[string]string{
|
||||
{
|
||||
"_welcome": "220 no newline",
|
||||
},
|
||||
|
||||
// MAIL FROM not allowed.
|
||||
map[string]string{
|
||||
{
|
||||
"_welcome": "220 mail from not allowed\n",
|
||||
"EHLO localhost": "250 ehlo ok\n",
|
||||
"MAIL FROM:<me@me>": "501 mail error\n",
|
||||
},
|
||||
|
||||
// RCPT TO not allowed.
|
||||
map[string]string{
|
||||
{
|
||||
"_welcome": "220 rcpt to not allowed\n",
|
||||
"EHLO localhost": "250 ehlo ok\n",
|
||||
"MAIL FROM:<me@me>": "250 mail ok\n",
|
||||
@@ -106,7 +106,7 @@ func TestSMTPErrors(t *testing.T) {
|
||||
},
|
||||
|
||||
// DATA error.
|
||||
map[string]string{
|
||||
{
|
||||
"_welcome": "220 data error\n",
|
||||
"EHLO localhost": "250 ehlo ok\n",
|
||||
"MAIL FROM:<me@me>": "250 mail ok\n",
|
||||
@@ -115,7 +115,7 @@ func TestSMTPErrors(t *testing.T) {
|
||||
},
|
||||
|
||||
// DATA response error.
|
||||
map[string]string{
|
||||
{
|
||||
"_welcome": "220 data response error\n",
|
||||
"EHLO localhost": "250 ehlo ok\n",
|
||||
"MAIL FROM:<me@me>": "250 mail ok\n",
|
||||
|
||||
Reference in New Issue
Block a user