From df964c8b2bfc7d61a7b95b923e1ec84662820932 Mon Sep 17 00:00:00 2001 From: Admin <2762713521@qq.com> Date: Sun, 1 Dec 2024 19:42:18 +0800 Subject: [PATCH] init --- mylog/safeStream_gen.go | 2 +- safemap/safemap_test.go | 6 +++--- stream/gen.go | 3 ++- stream/net/httpClient/Schemer_test.go | 9 +++++---- stream/other.go | 4 ++-- stream/topo.go | 1 + stream/topo_test.go | 2 ++ 7 files changed, 16 insertions(+), 11 deletions(-) diff --git a/mylog/safeStream_gen.go b/mylog/safeStream_gen.go index 8d4b0275..960f79c7 100644 --- a/mylog/safeStream_gen.go +++ b/mylog/safeStream_gen.go @@ -27,7 +27,7 @@ import ( "unicode/utf8" "github.com/dc0d/caseconv" - + "github.com/rivo/uniseg" "mvdan.cc/gofumpt/format" ) diff --git a/safemap/safemap_test.go b/safemap/safemap_test.go index 87fa22d2..43003de9 100644 --- a/safemap/safemap_test.go +++ b/safemap/safemap_test.go @@ -128,7 +128,7 @@ func TestSafeMap_StoreAndLoad_Ordered(t *testing.T) { sm := New[int, string](Ordered) sm.Update(1, "one") - value, ok := sm.GetMust(1) + value, ok := sm.Get(1) if !ok || value != "one" { t.Errorf("expected 'one', got '%v'", value) } @@ -233,7 +233,7 @@ func BenchmarkSafeMap_Load(b *testing.B) { sm.Update(1, "value") b.ResetTimer() for i := 0; i < b.N; i++ { - sm.GetMust(1) + sm.Get(1) } } @@ -257,7 +257,7 @@ func BenchmarkSafeMap_Ordered_Load(b *testing.B) { sm.Update(1, "value") b.ResetTimer() for i := 0; i < b.N; i++ { - sm.GetMust(1) + sm.Get(1) } } diff --git a/stream/gen.go b/stream/gen.go index dce2b64c..0a507d56 100644 --- a/stream/gen.go +++ b/stream/gen.go @@ -3,13 +3,14 @@ package stream import ( _ "embed" "fmt" - "github.com/ddkwork/golibrary/safemap" "go/format" "path/filepath" "reflect" "strconv" "strings" + "github.com/ddkwork/golibrary/safemap" + "github.com/ddkwork/golibrary/mylog" ) diff --git a/stream/net/httpClient/Schemer_test.go b/stream/net/httpClient/Schemer_test.go index dcfaf99b..b78a5be7 100644 --- a/stream/net/httpClient/Schemer_test.go +++ b/stream/net/httpClient/Schemer_test.go @@ -3,12 +3,12 @@ package httpClient import ( "testing" - "github.com/ddkwork/golibrary/mylog" - "mvdan.cc/gofumpt/format" + "github.com/ddkwork/golibrary/safemap" "github.com/ddkwork/golibrary/assert" - + "github.com/ddkwork/golibrary/mylog" "github.com/ddkwork/golibrary/stream" + "mvdan.cc/gofumpt/format" ) func TestLayer_AssertKind(t *testing.T) { @@ -17,7 +17,8 @@ func TestLayer_AssertKind(t *testing.T) { } func TestGeneratedFile_Iota(t *testing.T) { - m := safemap.NewOrdered[string, string]() + m := safemap.NewOrdered[string, string](func(yield func(string, string) bool) { + }) m.Set("Http", "Http") m.Set("Https", "Https") m.Set("Socket4", "Socket4") diff --git a/stream/other.go b/stream/other.go index aac179f0..d46240e5 100644 --- a/stream/other.go +++ b/stream/other.go @@ -2,10 +2,10 @@ package stream import ( "embed" - "github.com/ddkwork/golibrary/safemap" - "path/filepath" + "github.com/ddkwork/golibrary/safemap" + "github.com/ddkwork/golibrary/mylog" ) diff --git a/stream/topo.go b/stream/topo.go index 49bedf7c..56337f4c 100644 --- a/stream/topo.go +++ b/stream/topo.go @@ -2,6 +2,7 @@ package stream import ( "fmt" + "github.com/ddkwork/golibrary/mylog" "github.com/ddkwork/golibrary/safemap" ) diff --git a/stream/topo_test.go b/stream/topo_test.go index 98a306cc..3983ac01 100644 --- a/stream/topo_test.go +++ b/stream/topo_test.go @@ -2,6 +2,8 @@ package stream import ( "testing" + + "github.com/ddkwork/golibrary/safemap" ) func TestTopologicalSort(t *testing.T) {