From 8e4d31c74cca756a19cb799772ebd439ae905457 Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Mon, 24 Mar 2025 10:39:40 +0000 Subject: [PATCH] Fix minor typos found by codespell This patch fixes some minor typos in comments and strings found by codespell. While at it, also expand some variable names that were not typos, but caused false positives, and end up being more readable anyway. --- chasquid.go | 9 +++++---- internal/aliases/aliases.go | 4 ++-- internal/courier/smtp_test.go | 2 +- internal/set/set_test.go | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/chasquid.go b/chasquid.go index c1a35cd..05a6b11 100644 --- a/chasquid.go +++ b/chasquid.go @@ -280,21 +280,21 @@ func loadCert(name, dir string, s *smtpsrv.Server) { func loadDomain(name, dir string, s *smtpsrv.Server) { s.AddDomain(name) - nu, err := s.AddUserDB(name, dir+"/users") + nusers, err := s.AddUserDB(name, dir+"/users") if err != nil { // If there is an error loading users, fail hard to make sure this is // noticed and fixed as soon as it happens. log.Fatalf(" %s: users file error: %v", name, err) } - na, err := s.AddAliasesFile(name, dir+"/aliases") + naliases, err := s.AddAliasesFile(name, dir+"/aliases") if err != nil { // If there's an error loading aliases, fail hard to make sure this is // noticed and fixed as soon as it happens. log.Fatalf(" %s: aliases file error: %v", name, err) } - nd, err := loadDKIM(name, dir, s) + ndkim, err := loadDKIM(name, dir, s) if err != nil { // DKIM errors are fatal because if the user set DKIM up, then we // don't want it to be failing silently, as that could cause @@ -302,7 +302,8 @@ func loadDomain(name, dir string, s *smtpsrv.Server) { log.Fatalf(" %s: DKIM loading error: %v", name, err) } - log.Infof(" %s (%d users, %d aliases, %d DKIM keys)", name, nu, na, nd) + log.Infof(" %s (%d users, %d aliases, %d DKIM keys)", + name, nusers, naliases, ndkim) } func loadDovecot(s *smtpsrv.Server, userdb, client string) { diff --git a/internal/aliases/aliases.go b/internal/aliases/aliases.go index 0fec20e..5db0f8e 100644 --- a/internal/aliases/aliases.go +++ b/internal/aliases/aliases.go @@ -271,8 +271,8 @@ func (v *Resolver) resolve(rcount int, addr string, tr *trace.Trace) ([]Recipien // aliases). // The queue will attempt delivery against this local (but // evidently non-existing) address, and the courier will emit a - // clearer failure, re-using the existing codepaths and - // simplifying the logic. + // clearer failure, reusing the existing codepaths and simplifying + // the logic. tr.Debugf("%d| no catch-all, returning %q", rcount, addr) return []Recipient{{addr, EMAIL}}, nil } diff --git a/internal/courier/smtp_test.go b/internal/courier/smtp_test.go index 76584c5..dd1bf97 100644 --- a/internal/courier/smtp_test.go +++ b/internal/courier/smtp_test.go @@ -58,7 +58,7 @@ func TestSMTP(t *testing.T) { // Put a non-existing host first, so we check that if the first host // doesn't work, we try with the rest. // The host we use is invalid, to avoid having to do an actual network - // lookup whick makes the test more hermetic. This is a hack, ideally we + // lookup which makes the test more hermetic. This is a hack, ideally we // would be able to override the default resolver, but Go does not // implement that yet. testMX["to"] = []*net.MX{ diff --git a/internal/set/set_test.go b/internal/set/set_test.go index e66dfc8..1eecabe 100644 --- a/internal/set/set_test.go +++ b/internal/set/set_test.go @@ -13,10 +13,10 @@ func TestString(t *testing.T) { s1.Add("a") s1.Add("b", "ccc") - expectStrings(s1, []string{"a", "b", "ccc"}, []string{"notin"}, t) + expectStrings(s1, []string{"a", "b", "ccc"}, []string{"not-in"}, t) s2 := NewString("a", "b", "c") - expectStrings(s2, []string{"a", "b", "c"}, []string{"notin"}, t) + expectStrings(s2, []string{"a", "b", "c"}, []string{"not-in"}, t) // Test that Has works (and not panics) on a nil set. var s3 *String