chore: update dependencies

This commit is contained in:
yusing
2025-05-14 21:00:53 +08:00
parent 8b3e058885
commit 8f9c76daa5
17 changed files with 115 additions and 123 deletions

View File

@@ -8,7 +8,7 @@ import (
"maps"
"github.com/puzpuzpuz/xsync/v3"
"github.com/puzpuzpuz/xsync/v4"
"github.com/yusing/go-proxy/internal/common"
"github.com/yusing/go-proxy/internal/gperr"
"github.com/yusing/go-proxy/internal/logging"
@@ -19,7 +19,7 @@ import (
type namespace string
type MapStore[VT any] struct {
*xsync.MapOf[string, VT]
*xsync.Map[string, VT]
}
type ObjectStore[Pointer Initializer] struct {
@@ -103,7 +103,7 @@ func Object[Ptr Initializer](namespace namespace) Ptr {
}
func (s *MapStore[VT]) Initialize() {
s.MapOf = xsync.NewMapOf[string, VT]()
s.Map = xsync.NewMap[string, VT]()
}
func (s MapStore[VT]) MarshalJSON() ([]byte, error) {
@@ -115,9 +115,9 @@ func (s *MapStore[VT]) UnmarshalJSON(data []byte) error {
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
s.MapOf = xsync.NewMapOf[string, VT](xsync.WithPresize(len(tmp)))
s.Map = xsync.NewMap[string, VT](xsync.WithPresize(len(tmp)))
for k, v := range tmp {
s.MapOf.Store(k, v)
s.Map.Store(k, v)
}
return nil
}

View File

@@ -31,7 +31,7 @@ func TestSaveLoadStore(t *testing.T) {
if v != "1" {
t.Fatalf("expected 1, got %q", v)
}
if loaded.MapOf == store.MapOf {
if loaded.Map == store.Map {
t.Fatal("expected different objects")
}
}