From a78c2eae243077c1fed5f7b056c64072d3c63ac8 Mon Sep 17 00:00:00 2001 From: CaiCandong <50507092+CaiCandong@users.noreply.github.com> Date: Thu, 7 Sep 2023 17:37:47 +0800 Subject: Replace `util.SliceXxx` with `slices.Xxx` (#26958) --- routers/api/packages/chef/auth.go | 3 ++- routers/api/v1/repo/repo.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'routers/api') diff --git a/routers/api/packages/chef/auth.go b/routers/api/packages/chef/auth.go index d895640894..53055bb682 100644 --- a/routers/api/packages/chef/auth.go +++ b/routers/api/packages/chef/auth.go @@ -16,6 +16,7 @@ import ( "net/http" "path" "regexp" + "slices" "strconv" "strings" "time" @@ -265,7 +266,7 @@ func verifyDataOld(signature, data []byte, pub *rsa.PublicKey) error { } } - if !util.SliceEqual(out[skip:], data) { + if !slices.Equal(out[skip:], data) { return fmt.Errorf("could not verify signature") } diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index 29f6a675d4..e86743d55a 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -7,6 +7,7 @@ package repo import ( "fmt" "net/http" + "slices" "strings" "time" @@ -235,7 +236,7 @@ func CreateUserRepo(ctx *context.APIContext, owner *user_model.User, opt api.Cre } // If the readme template does not exist, a 400 will be returned. - if opt.AutoInit && len(opt.Readme) > 0 && !util.SliceContains(repo_module.Readmes, opt.Readme) { + if opt.AutoInit && len(opt.Readme) > 0 && !slices.Contains(repo_module.Readmes, opt.Readme) { ctx.Error(http.StatusBadRequest, "", fmt.Errorf("readme template does not exist, available templates: %v", repo_module.Readmes)) return } -- cgit v1.2.3