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 /routers/api | |
parent | e97e883ad50774f249c8c694598c25a17227299b (diff) | |
download | gitea-a78c2eae243077c1fed5f7b056c64072d3c63ac8.tar.gz gitea-a78c2eae243077c1fed5f7b056c64072d3c63ac8.zip |
Replace `util.SliceXxx` with `slices.Xxx` (#26958)
Diffstat (limited to 'routers/api')
-rw-r--r-- | routers/api/packages/chef/auth.go | 3 | ||||
-rw-r--r-- | routers/api/v1/repo/repo.go | 3 |
2 files changed, 4 insertions, 2 deletions
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 } |