Commit d6b51216 authored by Alberto Bertogli's avatar Alberto Bertogli

Make it explicit when we are intentionally not checking errors

The linter complains that we're not checking for errors, but on some
cases it's on code paths were it is reasonable to do so (e.g. we're
closing the connection and it's a best-effort write).

This patch adjusts the code to make those cases explicit.
parent aed01565
......@@ -209,7 +209,7 @@ func initMailLog(path string) {
if path == "<syslog>" {
maillog.Default, err = maillog.NewSyslog()
} else {
os.MkdirAll(filepath.Dir(path), 0775)
_ = os.MkdirAll(filepath.Dir(path), 0775)
var f *os.File
f, err = os.OpenFile(path, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0664)
maillog.Default = maillog.New(f)
......@@ -309,7 +309,7 @@ func launchMonitoringServer(addr string) {
flags := dumpFlags()
http.HandleFunc("/debug/flags", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(flags))
_, _ = w.Write([]byte(flags))
})
go http.ListenAndServe(addr, nil)
......
......@@ -208,7 +208,7 @@ func aliasesResolve() {
if err != nil {
Fatalf("Error reading config")
}
os.Chdir(configDir)
_ = os.Chdir(configDir)
r := aliases.NewResolver()
r.SuffixSep = conf.SuffixSeparators
......@@ -294,7 +294,7 @@ func aliasesAdd() {
if err != nil {
Fatalf("Error reading config")
}
os.Chdir(configDir)
_ = os.Chdir(configDir)
// Setup alias resolver.
r := aliases.NewResolver()
......
......@@ -220,7 +220,7 @@ retry:
return a.tr.Errorf("DATA closing %v", err), smtp.IsPermanent(err)
}
c.Quit()
_ = c.Quit()
a.tr.Debugf("done")
return nil, false
......
......@@ -250,7 +250,7 @@ loop:
case "AUTH":
code, msg = c.AUTH(params)
case "QUIT":
c.writeResponse(221, "2.0.0 Be seeing you...")
_ = c.writeResponse(221, "2.0.0 Be seeing you...")
break loop
default:
// Sanitize it a bit to avoid filling the logs and events with
......@@ -272,7 +272,7 @@ loop:
if errCount > 10 {
// https://tools.ietf.org/html/rfc5321#section-4.3.2
c.tr.Errorf("too many errors, breaking connection")
c.writeResponse(421, "4.5.0 Too many errors, bye")
_ = c.writeResponse(421, "4.5.0 Too many errors, bye")
break
}
}
......@@ -1090,9 +1090,9 @@ func (c *Conn) writeResponse(code int, msg string) error {
return writeResponse(c.writer, code, msg)
}
func (c *Conn) printfLine(format string, args ...interface{}) error {
func (c *Conn) printfLine(format string, args ...interface{}) {
fmt.Fprintf(c.writer, format+"\r\n", args...)
return c.writer.Flush()
c.writer.Flush()
}
// writeResponse writes a multi-line response to the given writer.
......
......@@ -156,7 +156,7 @@ func (s *Server) InitQueue(path string, localC, remoteC courier.Courier) {
http.HandleFunc("/debug/queue",
func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(q.DumpString()))
_, _ = w.Write([]byte(q.DumpString()))
})
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment