diff options
author | CaiCandong <50507092+CaiCandong@users.noreply.github.com> | 2023-09-07 17:37:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-07 09:37:47 +0000 |
commit | a78c2eae243077c1fed5f7b056c64072d3c63ac8 (patch) | |
tree | 53b63a8dafde117e76f5fede968e384ae55779b1 /modules/indexer | |
parent | e97e883ad50774f249c8c694598c25a17227299b (diff) | |
download | gitea-a78c2eae243077c1fed5f7b056c64072d3c63ac8.tar.gz gitea-a78c2eae243077c1fed5f7b056c64072d3c63ac8.zip |
Replace `util.SliceXxx` with `slices.Xxx` (#26958)
Diffstat (limited to 'modules/indexer')
-rw-r--r-- | modules/indexer/code/indexer.go | 10 | ||||
-rw-r--r-- | modules/indexer/issues/internal/tests/tests.go | 9 |
2 files changed, 10 insertions, 9 deletions
diff --git a/modules/indexer/code/indexer.go b/modules/indexer/code/indexer.go index 13d06874c9..80bde7614f 100644 --- a/modules/indexer/code/indexer.go +++ b/modules/indexer/code/indexer.go @@ -7,6 +7,7 @@ import ( "context" "os" "runtime/pprof" + "slices" "sync/atomic" "time" @@ -20,7 +21,6 @@ import ( "code.gitea.io/gitea/modules/process" "code.gitea.io/gitea/modules/queue" "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/util" ) var ( @@ -54,22 +54,22 @@ func index(ctx context.Context, indexer internal.Indexer, repoID int64) error { } // skip forks from being indexed if unit is not present - if !util.SliceContains(repoTypes, "forks") && repo.IsFork { + if !slices.Contains(repoTypes, "forks") && repo.IsFork { return nil } // skip mirrors from being indexed if unit is not present - if !util.SliceContains(repoTypes, "mirrors") && repo.IsMirror { + if !slices.Contains(repoTypes, "mirrors") && repo.IsMirror { return nil } // skip templates from being indexed if unit is not present - if !util.SliceContains(repoTypes, "templates") && repo.IsTemplate { + if !slices.Contains(repoTypes, "templates") && repo.IsTemplate { return nil } // skip regular repos from being indexed if unit is not present - if !util.SliceContains(repoTypes, "sources") && !repo.IsFork && !repo.IsMirror && !repo.IsTemplate { + if !slices.Contains(repoTypes, "sources") && !repo.IsFork && !repo.IsMirror && !repo.IsTemplate { return nil } diff --git a/modules/indexer/issues/internal/tests/tests.go b/modules/indexer/issues/internal/tests/tests.go index 93d38a0b37..06fddeb65b 100644 --- a/modules/indexer/issues/internal/tests/tests.go +++ b/modules/indexer/issues/internal/tests/tests.go @@ -10,6 +10,7 @@ package tests import ( "context" "fmt" + "slices" "testing" "time" @@ -457,7 +458,7 @@ var cases = []*testIndexerCase{ assert.Contains(t, data[v.ID].MentionIDs, int64(1)) } assert.Equal(t, countIndexerData(data, func(v *internal.IndexerData) bool { - return util.SliceContains(v.MentionIDs, 1) + return slices.Contains(v.MentionIDs, 1) }), result.Total) }, }, @@ -478,7 +479,7 @@ var cases = []*testIndexerCase{ assert.Contains(t, data[v.ID].ReviewedIDs, int64(1)) } assert.Equal(t, countIndexerData(data, func(v *internal.IndexerData) bool { - return util.SliceContains(v.ReviewedIDs, 1) + return slices.Contains(v.ReviewedIDs, 1) }), result.Total) }, }, @@ -499,7 +500,7 @@ var cases = []*testIndexerCase{ assert.Contains(t, data[v.ID].ReviewRequestedIDs, int64(1)) } assert.Equal(t, countIndexerData(data, func(v *internal.IndexerData) bool { - return util.SliceContains(v.ReviewRequestedIDs, 1) + return slices.Contains(v.ReviewRequestedIDs, 1) }), result.Total) }, }, @@ -520,7 +521,7 @@ var cases = []*testIndexerCase{ assert.Contains(t, data[v.ID].SubscriberIDs, int64(1)) } assert.Equal(t, countIndexerData(data, func(v *internal.IndexerData) bool { - return util.SliceContains(v.SubscriberIDs, 1) + return slices.Contains(v.SubscriberIDs, 1) }), result.Total) }, }, |