mirror of
https://github.com/hanzoai/mail.git
synced 2026-09-23 23:53:02 +00:00
run modernize
This commit is contained in:
@@ -94,10 +94,6 @@ govendor:
|
||||
go mod vendor
|
||||
./genlicenses.sh
|
||||
|
||||
modernize:
|
||||
# skip slicescontains because it rewrites to unintuitive slices.ContainsFunc
|
||||
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -category=-slicescontains -fix -test ./...
|
||||
|
||||
test-integration:
|
||||
-docker compose -f docker-compose-integration.yml kill
|
||||
-docker compose -f docker-compose-integration.yml down
|
||||
@@ -127,6 +123,9 @@ fmt:
|
||||
fix:
|
||||
go fix ./...
|
||||
|
||||
modernize:
|
||||
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./...
|
||||
|
||||
tswatch:
|
||||
bash -c 'while true; do inotifywait -q -e close_write *.ts webadmin/*.ts webaccount/*.ts webmail/*.ts; make frontend; done'
|
||||
|
||||
|
||||
+2
-2
@@ -417,8 +417,8 @@ func verifySingle(log mlog.Log, tlsa adns.TLSA, cs tls.ConnectionState, allowedH
|
||||
// sure to include the trusted anchor. ../rfc/7671:835
|
||||
for _, chain := range chains {
|
||||
// If pkix verified, check if any of the certificates match.
|
||||
for i := len(chain) - 1; i >= 0; i-- {
|
||||
if match(chain[i]) {
|
||||
for _, c := range slices.Backward(chain) {
|
||||
if match(c) {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1416,7 +1416,7 @@ func xmailboxPatternMatcher(ref string, patterns []string) matchStringer {
|
||||
}
|
||||
|
||||
// Fix casing for all Inbox paths.
|
||||
first := strings.SplitN(s, "/", 2)[0]
|
||||
first, _, _ := strings.Cut(s, "/")
|
||||
if strings.EqualFold(first, "Inbox") {
|
||||
s = "Inbox" + s[len("Inbox"):]
|
||||
}
|
||||
|
||||
+2
-2
@@ -353,8 +353,8 @@ func (h *handler) Enabled(ctx context.Context, level slog.Level) bool {
|
||||
|
||||
func (h *handler) configMatch(level slog.Level) (slog.Level, bool) {
|
||||
c := *config.Load()
|
||||
for i := len(h.Pkgs) - 1; i >= 0; i-- {
|
||||
if l, ok := c[h.Pkgs[i]]; ok {
|
||||
for _, v := range slices.Backward(h.Pkgs) {
|
||||
if l, ok := c[v]; ok {
|
||||
return l, match(l, level)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log/slog"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
_ "embed"
|
||||
@@ -89,8 +90,8 @@ func ParseList(elog *slog.Logger, r io.Reader) (List, error) {
|
||||
} else {
|
||||
t = strings.Split(line, ".")
|
||||
}
|
||||
for i := len(t) - 1; i >= 0; i-- {
|
||||
w := t[i]
|
||||
for i, w := range slices.Backward(t) {
|
||||
|
||||
if w == "" {
|
||||
log.Print("empty label in rule, skipping", slog.String("line", oline))
|
||||
break
|
||||
|
||||
+2
-2
@@ -136,8 +136,8 @@ output of "mox config describe-domains" and see the output of
|
||||
fatalf := func(format string, args ...any) {
|
||||
// We remove in reverse order because dirs would have been created first and must
|
||||
// be removed last, after their files have been removed.
|
||||
for i := len(cleanupPaths) - 1; i >= 0; i-- {
|
||||
p := cleanupPaths[i]
|
||||
for _, p := range slices.Backward(cleanupPaths) {
|
||||
|
||||
if err := os.Remove(p); err != nil {
|
||||
log.Printf("cleaning up %q: %s", p, err)
|
||||
}
|
||||
|
||||
+3
-2
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -200,8 +201,8 @@ func rdapDomainRequest(ctx context.Context, log mlog.Log, rdapURL string, dom dn
|
||||
})
|
||||
|
||||
now := time.Now()
|
||||
for i := len(domain.Events) - 1; i >= 0; i-- {
|
||||
ev := domain.Events[i]
|
||||
for _, ev := range slices.Backward(domain.Events) {
|
||||
|
||||
if ev.EventDate.After(now) {
|
||||
continue
|
||||
}
|
||||
|
||||
+4
-4
@@ -53,8 +53,8 @@ func assignThread(log mlog.Log, tx *bstore.Tx, m *Message, part *message.Part) e
|
||||
if err != nil {
|
||||
log.Errorx("assigning threads: parsing references/in-reply-to headers, not matching by message-id", err, slog.Int64("msgid", m.ID))
|
||||
}
|
||||
for i := len(messageIDs) - 1; i >= 0; i-- {
|
||||
messageID := messageIDs[i]
|
||||
for _, messageID := range slices.Backward(messageIDs) {
|
||||
|
||||
if messageID == m.MessageID {
|
||||
continue
|
||||
}
|
||||
@@ -300,8 +300,8 @@ func (a *Account) AssignThreads(ctx context.Context, log mlog.Log, txOpt *bstore
|
||||
log.Errorx("assigning threads: parsing references/in-reply-to headers, not matching by message-id", err, slog.Int64("msgid", m.ID))
|
||||
}
|
||||
|
||||
for i := len(refids) - 1; i >= 0; i-- {
|
||||
messageID := refids[i]
|
||||
for i, messageID := range slices.Backward(refids) {
|
||||
|
||||
if messageID == m.MessageID {
|
||||
continue
|
||||
}
|
||||
|
||||
+4
-3
@@ -20,6 +20,7 @@ import (
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime/debug"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -896,10 +897,10 @@ func inlineSanitizeHTML(log mlog.Log, setHeaders func(), w io.Writer, p *message
|
||||
// "<>", starting at the part's siblings, up the tree, and later from the
|
||||
// top-part down the tree.
|
||||
func findCID(p *message.Part, parents []*message.Part, cid string) *message.Part {
|
||||
for i := len(parents) - 1; i >= 0; i-- {
|
||||
for j, pp := range parents[i].Parts {
|
||||
for _, parent := range slices.Backward(parents) {
|
||||
for j, pp := range parent.Parts {
|
||||
if pp.ContentID != nil && strings.EqualFold(*pp.ContentID, cid) {
|
||||
return &parents[i].Parts[j]
|
||||
return &parent.Parts[j]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user