1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-10-28 15:02:28 +00:00

Apply more mechanical simplifications using recent Go features

This is a follow-up on the `go fix` run in commit
0210c5fd92.

That commit recorded the automated updates.

This one applies further simplifications that are mechanical and do not
involve logic changes, but are outside of what `go fix` did.

It also removes some now-obsolete comments and statements.
This commit is contained in:
Alberto Bertogli
2026-10-03 09:08:22 +01:00
parent 0210c5fd92
commit 8d763f450d
33 changed files with 99 additions and 161 deletions
+3 -7
View File
@@ -11,12 +11,8 @@ import (
// Split an user@domain address into user and domain.
func Split(addr string) (string, string) {
ps := strings.SplitN(addr, "@", 2)
if len(ps) != 2 {
return addr, ""
}
return ps[0], ps[1]
user, domain, _ := strings.Cut(addr, "@")
return user, domain
}
// UserOf user@domain returns user.
@@ -48,7 +44,7 @@ func AddHeader(data []byte, k, v string) []byte {
if v[len(v)-1] == '\n' {
v = v[:len(v)-1]
}
v = strings.Replace(v, "\n", "\n\t", -1)
v = strings.ReplaceAll(v, "\n", "\n\t")
}
header := []byte(fmt.Sprintf("%s: %s\n", k, v))