1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-03-14 03:29:35 +00:00

Fix misc. linter issues (comments, variable naming, etc.)

We've accumulated a few linter issues around comments and a couple of
variable names.

While none of them is major, this patch cleans them up so it's easier to
go through the linter output, and we can start being more strict about
it.
This commit is contained in:
Alberto Bertogli
2022-08-27 23:16:01 +01:00
parent 6dfff9a790
commit e85c31782b
11 changed files with 30 additions and 13 deletions

View File

@@ -60,11 +60,11 @@ func usersWithXDontExist(user, domain string) (bool, error) {
return true, nil
}
var userLookupError = errors.New("test error userLookupError")
var errUserLookup = errors.New("test error errUserLookup")
func usersWithXErrorYDontExist(user, domain string) (bool, error) {
if strings.HasPrefix(user, "x") {
return false, userLookupError
return false, errUserLookup
}
if strings.HasPrefix(user, "y") {
return false, nil
@@ -134,12 +134,12 @@ func TestUserLookupErrors(t *testing.T) {
cases := Cases{
{"a@dom", []Recipient{{"a@remote", EMAIL}}, nil},
{"b@dom", nil, userLookupError},
{"b@dom", nil, errUserLookup},
{"c@dom", []Recipient{{"c@dom", EMAIL}}, nil},
{"x@dom", nil, userLookupError},
{"x@dom", nil, errUserLookup},
// This one goes through the catch-all.
{"y@dom", nil, userLookupError},
{"y@dom", nil, errUserLookup},
}
cases.check(t, resolver)
}

View File

@@ -113,6 +113,8 @@ func TestSanitize(t *testing.T) {
// http://www.user.uni-hannover.de/nhtcapri/bidirectional-text.html
// We allow them, they're the same on both sides.
{"١٩٩٩–١٢–٣١", "١٩٩٩–١٢–٣١"},
//lint:ignore ST1018 The use of a literal U+200C is intentional.
{"موزه‌ها", "موزه\u200cها"},
}
for _, c := range cases {

View File

@@ -20,7 +20,8 @@ var (
testMXI = expvar.NewMap("testMXI")
testMXF = expvar.NewMap("testMXF")
testMEmpty = expvar.NewMap("testMEmpty") //nolint // Unused.
//lint:ignore U1000 Intentionally unused, should not be exported.
testMEmpty = expvar.NewMap("testMEmpty") //nolint
testMOther = expvar.NewMap("testMOther")

View File

@@ -174,6 +174,8 @@ func (s *Server) periodicallyReload() {
if reloadEvery == nil {
return
}
//lint:ignore SA1015 This lasts the program's lifetime.
for range time.Tick(*reloadEvery) {
err := s.aliasesR.Reload()
if err != nil {

View File

@@ -137,7 +137,7 @@ func (c dumbCourier) Deliver(from string, to string, data []byte) (error, bool)
// DumbCourier always succeeds delivery, and ignores everything.
var DumbCourier = dumbCourier{}
// generateCert generates a new, INSECURE self-signed certificate and writes
// GenerateCert generates a new, INSECURE self-signed certificate and writes
// it to a pair of (cert.pem, key.pem) files to the given path.
// Note the certificate is only useful for testing purposes.
func GenerateCert(path string) (*tls.Config, error) {