1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00

Miscellaneous style fixes

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

There are no functional changes.
This commit is contained in:
Alberto Bertogli
2019-02-10 12:46:15 +00:00
parent 582da79eca
commit ec95131bb4
6 changed files with 8 additions and 27 deletions

View File

@@ -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.

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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

View File

@@ -64,7 +64,6 @@ func testHTTPHandler(w http.ResponseWriter, r *http.Request) {
return
}
fmt.Fprintln(w, policy)
return
}
func TestMain(m *testing.M) {