| author | Alberto Bertogli
<albertito@blitiri.com.ar> 2025-10-24 11:00:18 UTC |
| committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2025-10-24 11:15:36 UTC |
| parent | 7a4a4e4b34c15eb976249b44997b70038713e114 |
| internal/dkim/dns_test.go | +0 | -4 |
| internal/localrpc/e2e_test.go | +3 | -3 |
| internal/smtpsrv/conn.go | +2 | -1 |
| internal/smtpsrv/server.go | +0 | -1 |
| test/util/smtpc/smtpc.go | +1 | -1 |
diff --git a/internal/dkim/dns_test.go b/internal/dkim/dns_test.go index 5d25ce7..2f7784d 100644 --- a/internal/dkim/dns_test.go +++ b/internal/dkim/dns_test.go @@ -3,8 +3,6 @@ package dkim import ( "context" "crypto" - "crypto/ed25519" - "crypto/x509" "encoding/base64" "errors" "testing" @@ -36,7 +34,6 @@ const exampleRSAKeyB64 = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQ" + "tdY9tf6mcwGjaNBcWToIMmPSPDdQPNUYckcQ2QIDAQAB" var exampleRSAKeyBuf, _ = base64.StdEncoding.DecodeString(exampleRSAKeyB64) -var exampleRSAKey, _ = x509.ParsePKCS1PublicKey(exampleRSAKeyBuf) // Ed25519 key from the RFC example. // https://datatracker.ietf.org/doc/html/rfc8463#appendix-A.2 @@ -44,7 +41,6 @@ const exampleEd25519KeyB64 = "11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo=" var exampleEd25519KeyBuf, _ = base64.StdEncoding.DecodeString( exampleEd25519KeyB64) -var exampleEd25519Key = ed25519.PublicKey(exampleEd25519KeyBuf) var results = map[string][]string{} var resultErr = map[string]error{} diff --git a/internal/localrpc/e2e_test.go b/internal/localrpc/e2e_test.go index 1366a62..7f72d90 100644 --- a/internal/localrpc/e2e_test.go +++ b/internal/localrpc/e2e_test.go @@ -22,10 +22,10 @@ func Hola(tr *trace.Trace, input url.Values) (url.Values, error) { return output, nil } -var testErr = errors.New("test error") +var errTest = errors.New("test error") func HolaErr(tr *trace.Trace, input url.Values) (url.Values, error) { - return nil, testErr + return nil, errTest } type testServer struct { @@ -86,7 +86,7 @@ func TestEndToEnd(t *testing.T) { {"Echo", nil, mkV(), nil}, {"Echo", mkV("msg", "hola"), mkV("msg", "hola"), nil}, {"Hola", mkV("name", "marola"), mkV("greeting", "Hola marola"), nil}, - {"HolaErr", nil, nil, testErr}, + {"HolaErr", nil, nil, errTest}, {"UnknownMethod", nil, nil, errUnknownMethod}, } diff --git a/internal/smtpsrv/conn.go b/internal/smtpsrv/conn.go index 8a67e42..b0a8208 100644 --- a/internal/smtpsrv/conn.go +++ b/internal/smtpsrv/conn.go @@ -5,6 +5,7 @@ import ( "bytes" "context" "crypto/tls" + "errors" "flag" "fmt" "io" @@ -944,7 +945,7 @@ func (c *Conn) runPostDataHook(data []byte) ([]byte, bool, error) { // The error contains the last line of stdout, so filters can pass // some rejection information back to the sender. - err = fmt.Errorf(lastLine(string(out))) + err = errors.New(lastLine(string(out))) return nil, permanent, err } diff --git a/internal/smtpsrv/server.go b/internal/smtpsrv/server.go index ea27185..9f503af 100644 --- a/internal/smtpsrv/server.go +++ b/internal/smtpsrv/server.go @@ -282,7 +282,6 @@ func (s *Server) periodicallyReload() { return } - //lint:ignore SA1015 This lasts the program's lifetime. for range time.Tick(*reloadEvery) { s.Reload() } diff --git a/test/util/smtpc/smtpc.go b/test/util/smtpc/smtpc.go index 9b85312..0d95972 100644 --- a/test/util/smtpc/smtpc.go +++ b/test/util/smtpc/smtpc.go @@ -56,11 +56,11 @@ func main() { } conn, err = tls.Dial("tcp", *addr, tlsConfig) - defer conn.Close() } else { conn, err = net.Dial("tcp", *addr) } notnil(err) + defer conn.Close() // Send the message. client, err := smtp.NewClient(conn, *addr)