Skip to content

Commit

Permalink
only use constant strings in string formatting
Browse files Browse the repository at this point in the history
builds with go1.24rc1 fail on these.
only the case in smtpserver could be triggered externally.
  • Loading branch information
mjl- committed Dec 14, 2024
1 parent 5320ec1 commit d082aaa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions dkim/sig.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (s *Sig) Header() (string, error) {
} else if i == len(s.SignedHeaders)-1 {
v += ";"
}
w.Addf(sep, v)
w.Addf(sep, "%s", v)
}
}
if len(s.CopiedHeaders) > 0 {
Expand All @@ -139,7 +139,7 @@ func (s *Sig) Header() (string, error) {
} else if i == len(s.CopiedHeaders)-1 {
v += ";"
}
w.Addf(sep, v)
w.Addf(sep, "%s", v)
}
}

Expand Down
12 changes: 6 additions & 6 deletions imapserver/selectexamine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,28 @@ func testSelectExamine(t *testing.T, examine bool) {
uuidnext2 := imapclient.UntaggedResult{Status: imapclient.OK, RespText: imapclient.RespText{Code: "UIDNEXT", CodeArg: imapclient.CodeUint{Code: "UIDNEXT", Num: 2}, More: "x"}}

// Parameter required.
tc.transactf("bad", cmd)
tc.transactf("bad", "%s", cmd)

// Mailbox does not exist.
tc.transactf("no", cmd+" bogus")
tc.transactf("no", "%s bogus", cmd)

tc.transactf("ok", cmd+" inbox")
tc.transactf("ok", "%s inbox", cmd)
tc.xuntagged(uflags, upermflags, urecent, uexists0, uuidval1, uuidnext1, ulist)
tc.xcode(okcode)

tc.transactf("ok", cmd+` "inbox"`)
tc.transactf("ok", `%s "inbox"`, cmd)
tc.xuntagged(uclosed, uflags, upermflags, urecent, uexists0, uuidval1, uuidnext1, ulist)
tc.xcode(okcode)

// Append a message. It will be reported as UNSEEN.
tc.client.Append("inbox", nil, nil, []byte(exampleMsg))
tc.transactf("ok", cmd+" inbox")
tc.transactf("ok", "%s inbox", cmd)
tc.xuntagged(uclosed, uflags, upermflags, urecent, uunseen, uexists1, uuidval1, uuidnext2, ulist)
tc.xcode(okcode)

// With imap4rev2, we no longer get untagged RECENT or untagged UNSEEN.
tc.client.Enable("imap4rev2")
tc.transactf("ok", cmd+" inbox")
tc.transactf("ok", "%s inbox", cmd)
tc.xuntagged(uclosed, uflags, upermflags, uexists1, uuidval1, uuidnext2, ulist)
tc.xcode(okcode)
}
2 changes: 1 addition & 1 deletion imapserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ func (c *conn) xsequence(uid store.UID) msgseq {
func (c *conn) sequenceRemove(seq msgseq, uid store.UID) {
i := seq - 1
if c.uids[i] != uid {
xserverErrorf(fmt.Sprintf("got uid %d at msgseq %d, expected uid %d", uid, seq, c.uids[i]))
xserverErrorf("got uid %d at msgseq %d, expected uid %d", uid, seq, c.uids[i])
}
copy(c.uids[i:], c.uids[i+1:])
c.uids = c.uids[:len(c.uids)-1]
Expand Down
2 changes: 1 addition & 1 deletion smtpserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3471,7 +3471,7 @@ func (c *conn) deliver(ctx context.Context, recvHdrFor func(string) string, msgW
code = smtp.C554TransactionFailed
}
lines = append(lines, "multiple errors")
xsmtpErrorf(code, secode, !serverError, strings.Join(lines, "\n"))
xsmtpErrorf(code, secode, !serverError, "%s", strings.Join(lines, "\n"))
}
// Generate one DSN for all failed recipients.
if len(deliverErrors) > 0 {
Expand Down

0 comments on commit d082aaa

Please sign in to comment.