Commit ec95131b authored by Alberto Bertogli's avatar Alberto Bertogli

Miscellaneous style fixes

This patch has some miscellaneous style fixes to issues found by the
staticcheck tool.

There are no functional changes.
parent 582da79e
......@@ -246,7 +246,7 @@ func (v *Resolver) Reload() error {
continue
}
if err != nil {
return fmt.Errorf("Error parsing %q: %v", path, err)
return fmt.Errorf("error parsing %q: %v", path, err)
}
// Add the aliases to the resolver, overriding any previous values.
......
......@@ -148,7 +148,7 @@ func DecodeResponse(response string) (user, domain, passwd string, err error) {
bufsp := bytes.SplitN(buf, []byte{0}, 3)
if len(bufsp) != 3 {
err = fmt.Errorf("Response pieces != 3, as per RFC")
err = fmt.Errorf("response pieces != 3, as per RFC")
return
}
......@@ -163,7 +163,7 @@ func DecodeResponse(response string) (user, domain, passwd string, err error) {
// If neither is empty, then they must be the same.
if (z != "" && c != "") && (z != c) {
err = fmt.Errorf("Auth IDs do not match")
err = fmt.Errorf("auth IDs do not match")
return
}
......@@ -176,7 +176,7 @@ func DecodeResponse(response string) (user, domain, passwd string, err error) {
}
if identity == "" {
err = fmt.Errorf("Empty identity, must be in the form user@domain")
err = fmt.Errorf("empty identity, must be in the form user@domain")
return
}
......@@ -184,7 +184,7 @@ func DecodeResponse(response string) (user, domain, passwd string, err error) {
// This is NOT an RFC requirement, it's our own.
idsp := strings.SplitN(identity, "@", 2)
if len(idsp) != 2 {
err = fmt.Errorf("Identity must be in the form user@domain")
err = fmt.Errorf("identity must be in the form user@domain")
return
}
......
......@@ -15,7 +15,7 @@ import (
)
var (
errTimeout = fmt.Errorf("Operation timed out")
errTimeout = fmt.Errorf("operation timed out")
)
// Procmail delivers local mail by executing a local binary, like procmail or
......@@ -79,7 +79,7 @@ func (p *Procmail) Deliver(from string, to string, data []byte) (error, bool) {
permanent = status.ExitStatus() != 75
}
}
err = tr.Errorf("Procmail failed: %v - %q", err, string(output))
err = tr.Errorf("procmail failed: %v - %q", err, string(output))
return err, permanent
}
......
......@@ -213,7 +213,7 @@ func expect(conn *textproto.Conn, prefix string) error {
}
func write(conn *textproto.Conn, msg string) error {
_, err := fmt.Fprintf(conn.W, msg)
_, err := conn.W.Write([]byte(msg))
if err != nil {
return err
}
......
......@@ -13,30 +13,12 @@ import (
"blitiri.com.ar/go/chasquid/internal/testlib"
)
// Test courier. Delivery is done by sending on a channel, so users have fine
// grain control over the results.
type ChanCourier struct {
requests chan deliverRequest
results chan error
}
type deliverRequest struct {
from string
to string
data []byte
}
func (cc *ChanCourier) Deliver(from string, to string, data []byte) (error, bool) {
cc.requests <- deliverRequest{from, to, data}
return <-cc.results, false
}
func newChanCourier() *ChanCourier {
return &ChanCourier{
requests: make(chan deliverRequest),
results: make(chan error),
}
}
// Courier for test purposes. Never fails, and always remembers everything.
type TestCourier struct {
wg sync.WaitGroup
......
......@@ -64,7 +64,6 @@ func testHTTPHandler(w http.ResponseWriter, r *http.Request) {
return
}
fmt.Fprintln(w, policy)
return
}
func TestMain(m *testing.M) {
......
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