From acec30317972d52be9b98ded2b311f75aac57f39 Mon Sep 17 00:00:00 2001 From: Tony Chen Date: Mon, 8 May 2023 15:06:29 +0800 Subject: [PATCH] move pkg to internal (#38) --- circuitbreaker/sre/sre.go | 2 +- circuitbreaker/sre/sre_test.go | 2 +- {consistent => internal/consistent}/consistent.go | 0 {consistent => internal/consistent}/consistent_test.go | 0 {pkg => internal}/cpu/cgroup.go | 0 {pkg => internal}/cpu/cgroup_cpu.go | 0 {pkg => internal}/cpu/psutil_cpu.go | 0 {pkg => internal}/cpu/stat.go | 0 {pkg => internal}/cpu/stat_test.go | 3 ++- {pkg => internal}/cpu/utils.go | 0 {pkg => internal}/minheap/minheap.go | 0 {pkg => internal}/window/counter.go | 0 {pkg => internal}/window/counter_test.go | 0 {pkg => internal}/window/iterator.go | 0 {pkg => internal}/window/policy.go | 0 {pkg => internal}/window/policy_test.go | 0 {pkg => internal}/window/reduce.go | 0 {pkg => internal}/window/window.go | 0 {pkg => internal}/window/window_test.go | 0 ratelimit/bbr/bbr.go | 4 ++-- ratelimit/bbr/bbr_test.go | 2 +- subset/subset.go | 2 +- subset/subset_test.go | 2 +- topk/heavykeeper.go | 2 +- 24 files changed, 10 insertions(+), 9 deletions(-) rename {consistent => internal/consistent}/consistent.go (100%) rename {consistent => internal/consistent}/consistent_test.go (100%) rename {pkg => internal}/cpu/cgroup.go (100%) rename {pkg => internal}/cpu/cgroup_cpu.go (100%) rename {pkg => internal}/cpu/psutil_cpu.go (100%) rename {pkg => internal}/cpu/stat.go (100%) rename {pkg => internal}/cpu/stat_test.go (89%) rename {pkg => internal}/cpu/utils.go (100%) rename {pkg => internal}/minheap/minheap.go (100%) rename {pkg => internal}/window/counter.go (100%) rename {pkg => internal}/window/counter_test.go (100%) rename {pkg => internal}/window/iterator.go (100%) rename {pkg => internal}/window/policy.go (100%) rename {pkg => internal}/window/policy_test.go (100%) rename {pkg => internal}/window/reduce.go (100%) rename {pkg => internal}/window/window.go (100%) rename {pkg => internal}/window/window_test.go (100%) diff --git a/circuitbreaker/sre/sre.go b/circuitbreaker/sre/sre.go index 7c71be8..64c0caa 100644 --- a/circuitbreaker/sre/sre.go +++ b/circuitbreaker/sre/sre.go @@ -8,7 +8,7 @@ import ( "time" "github.com/go-kratos/aegis/circuitbreaker" - "github.com/go-kratos/aegis/pkg/window" + "github.com/go-kratos/aegis/internal/window" ) // Option is sre breaker option function. diff --git a/circuitbreaker/sre/sre_test.go b/circuitbreaker/sre/sre_test.go index b021828..28d6c9f 100644 --- a/circuitbreaker/sre/sre_test.go +++ b/circuitbreaker/sre/sre_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/go-kratos/aegis/pkg/window" + "github.com/go-kratos/aegis/internal/window" "github.com/stretchr/testify/assert" ) diff --git a/consistent/consistent.go b/internal/consistent/consistent.go similarity index 100% rename from consistent/consistent.go rename to internal/consistent/consistent.go diff --git a/consistent/consistent_test.go b/internal/consistent/consistent_test.go similarity index 100% rename from consistent/consistent_test.go rename to internal/consistent/consistent_test.go diff --git a/pkg/cpu/cgroup.go b/internal/cpu/cgroup.go similarity index 100% rename from pkg/cpu/cgroup.go rename to internal/cpu/cgroup.go diff --git a/pkg/cpu/cgroup_cpu.go b/internal/cpu/cgroup_cpu.go similarity index 100% rename from pkg/cpu/cgroup_cpu.go rename to internal/cpu/cgroup_cpu.go diff --git a/pkg/cpu/psutil_cpu.go b/internal/cpu/psutil_cpu.go similarity index 100% rename from pkg/cpu/psutil_cpu.go rename to internal/cpu/psutil_cpu.go diff --git a/pkg/cpu/stat.go b/internal/cpu/stat.go similarity index 100% rename from pkg/cpu/stat.go rename to internal/cpu/stat.go diff --git a/pkg/cpu/stat_test.go b/internal/cpu/stat_test.go similarity index 89% rename from pkg/cpu/stat_test.go rename to internal/cpu/stat_test.go index ed27830..9069c38 100644 --- a/pkg/cpu/stat_test.go +++ b/internal/cpu/stat_test.go @@ -8,7 +8,8 @@ import ( ) func TestStat(t *testing.T) { - time.Sleep(time.Second * 2) + time.Sleep(time.Second * 3) + var s Stat var i Info ReadStat(&s) diff --git a/pkg/cpu/utils.go b/internal/cpu/utils.go similarity index 100% rename from pkg/cpu/utils.go rename to internal/cpu/utils.go diff --git a/pkg/minheap/minheap.go b/internal/minheap/minheap.go similarity index 100% rename from pkg/minheap/minheap.go rename to internal/minheap/minheap.go diff --git a/pkg/window/counter.go b/internal/window/counter.go similarity index 100% rename from pkg/window/counter.go rename to internal/window/counter.go diff --git a/pkg/window/counter_test.go b/internal/window/counter_test.go similarity index 100% rename from pkg/window/counter_test.go rename to internal/window/counter_test.go diff --git a/pkg/window/iterator.go b/internal/window/iterator.go similarity index 100% rename from pkg/window/iterator.go rename to internal/window/iterator.go diff --git a/pkg/window/policy.go b/internal/window/policy.go similarity index 100% rename from pkg/window/policy.go rename to internal/window/policy.go diff --git a/pkg/window/policy_test.go b/internal/window/policy_test.go similarity index 100% rename from pkg/window/policy_test.go rename to internal/window/policy_test.go diff --git a/pkg/window/reduce.go b/internal/window/reduce.go similarity index 100% rename from pkg/window/reduce.go rename to internal/window/reduce.go diff --git a/pkg/window/window.go b/internal/window/window.go similarity index 100% rename from pkg/window/window.go rename to internal/window/window.go diff --git a/pkg/window/window_test.go b/internal/window/window_test.go similarity index 100% rename from pkg/window/window_test.go rename to internal/window/window_test.go diff --git a/ratelimit/bbr/bbr.go b/ratelimit/bbr/bbr.go index c05ea43..2d76216 100644 --- a/ratelimit/bbr/bbr.go +++ b/ratelimit/bbr/bbr.go @@ -6,8 +6,8 @@ import ( "sync/atomic" "time" - "github.com/go-kratos/aegis/pkg/cpu" - "github.com/go-kratos/aegis/pkg/window" + "github.com/go-kratos/aegis/internal/cpu" + "github.com/go-kratos/aegis/internal/window" "github.com/go-kratos/aegis/ratelimit" ) diff --git a/ratelimit/bbr/bbr_test.go b/ratelimit/bbr/bbr_test.go index 47ec712..13cf262 100644 --- a/ratelimit/bbr/bbr_test.go +++ b/ratelimit/bbr/bbr_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/go-kratos/aegis/pkg/window" + "github.com/go-kratos/aegis/internal/window" "github.com/go-kratos/aegis/ratelimit" "github.com/stretchr/testify/assert" ) diff --git a/subset/subset.go b/subset/subset.go index 3f909ba..c582457 100644 --- a/subset/subset.go +++ b/subset/subset.go @@ -1,7 +1,7 @@ package subset import ( - "github.com/go-kratos/aegis/consistent" + "github.com/go-kratos/aegis/internal/consistent" ) func Subset[M consistent.Member](selectKey string, inss []M, num int) []M { diff --git a/subset/subset_test.go b/subset/subset_test.go index 4a2af74..c1c2223 100644 --- a/subset/subset_test.go +++ b/subset/subset_test.go @@ -6,7 +6,7 @@ import ( "math/rand" "testing" - "github.com/go-kratos/aegis/consistent" + "github.com/go-kratos/aegis/internal/consistent" "github.com/google/uuid" "github.com/stretchr/testify/assert" ) diff --git a/topk/heavykeeper.go b/topk/heavykeeper.go index 54ac8a1..0042ea0 100644 --- a/topk/heavykeeper.go +++ b/topk/heavykeeper.go @@ -7,7 +7,7 @@ import ( "math" "math/rand" - "github.com/go-kratos/aegis/pkg/minheap" + "github.com/go-kratos/aegis/internal/minheap" "github.com/twmb/murmur3" )