Bump pkglib to go1.22 version

This commit is contained in:
Tom Wiesing 2024-04-08 23:37:04 +02:00
parent 84799afda2
commit 2d1f3e3819
No known key found for this signature in database
9 changed files with 31 additions and 36 deletions

View file

@ -42,7 +42,7 @@ func (log *Logger) For(ctx context.Context, slug string) (exports []models.Expor
return nil, err
}
return collection.Filter(exports, func(s models.Export) bool {
return collection.KeepFunc(exports, func(s models.Export) bool {
return s.Slug == slug
}), nil
}

View file

@ -138,11 +138,12 @@ func MarshalMap(m map[string]any) string {
var builder strings.Builder
builder.WriteString("array(")
collection.IterateSorted(m, func(k string, v any) {
collection.IterateSorted(m, func(k string, v any) bool {
builder.WriteString(MarshalString(k))
builder.WriteString("=>")
builder.WriteString(MarshalJSON(v))
builder.WriteString(",")
return true
})
builder.WriteString(")")

View file

@ -9,12 +9,12 @@ import (
"io"
"os"
"regexp"
"slices"
"strings"
"sync"
_ "embed"
"github.com/tkw1536/pkglib/collection"
"github.com/tkw1536/pkglib/lazy"
"github.com/tkw1536/pkglib/status"
"github.com/tkw1536/pkglib/stream"
@ -285,8 +285,8 @@ func init() {
}
// remove comment lines
lines = collection.Filter(lines, func(line string) bool {
return !strings.HasPrefix(line, "//")
lines = slices.DeleteFunc(lines, func(line string) bool {
return strings.HasPrefix(line, "//")
})
serverPHP = minifier.ReplaceAllString(strings.Join(lines, ""), "$1")

View file

@ -88,7 +88,7 @@ func (prefixes *Prefixes) getLivePrefixes(ctx context.Context, server *phpx.Serv
}
// filter out blocked prefixes
return collection.Filter(pfs, func(uri string) bool { return !hasAnyPrefix(uri, blocks) }), nil
return slices.DeleteFunc(pfs, func(uri string) bool { return hasAnyPrefix(uri, blocks) }), nil
}
func (wisski *Prefixes) getAdapterPrefixes(ctx context.Context, server *phpx.Server) (pfs []string, err error) {