mirror of
https://github.com/mjl-/mox.git
synced 2025-07-13 03:34:39 +03:00
Run modernize to rewrite some older go constructs to newer ones
Mostly using slice.Sort, using min/max, slices.Concat, range of int and fmt.Appendf for byte slices instead of strings.
This commit is contained in:
@ -77,7 +77,7 @@ func (a *clientPlain) Next(fromServer []byte) (toServer []byte, last bool, rerr
|
||||
defer func() { a.step++ }()
|
||||
switch a.step {
|
||||
case 0:
|
||||
return []byte(fmt.Sprintf("\u0000%s\u0000%s", a.Username, a.Password)), true, nil
|
||||
return fmt.Appendf(nil, "\u0000%s\u0000%s", a.Username, a.Password), true, nil
|
||||
default:
|
||||
return nil, false, fmt.Errorf("invalid step %d", a.step)
|
||||
}
|
||||
@ -189,7 +189,7 @@ func (a *clientCRAMMD5) Next(fromServer []byte) (toServer []byte, last bool, rer
|
||||
opadh.Write(ipadh.Sum(nil))
|
||||
|
||||
// ../rfc/2195:88
|
||||
return []byte(fmt.Sprintf("%s %x", a.Username, opadh.Sum(nil))), true, nil
|
||||
return fmt.Appendf(nil, "%s %x", a.Username, opadh.Sum(nil)), true, nil
|
||||
|
||||
default:
|
||||
return nil, false, fmt.Errorf("invalid step %d", a.step)
|
||||
|
Reference in New Issue
Block a user